Fold patch-1 into master (IE11 fix) (#3) (#361)

Fold patch-1 into master (IE11 fix) (#3) (#361)
  • Prototype for fetch API support

Proposal/concept for #348

This solution detects the availability of the fetch API and patches is in such a way that allows us to inspect the response headers for mini profiler headers before resolving the promise to the original promise handler chain.

  • Bug fix

Perform a cases insensitive comparison of the header name

  • Remove warning per feedback

  • Change for…of to es5 loop

From c19c34a4a06e317588529bdc299abffa05b64e87 Mon Sep 17 00:00:00 2001
From: Shyam Habarakada <shyam.habarakada@gmail.com>
Date: Sun, 9 Dec 2018 18:36:10 -0800
Subject: [PATCH] Fold patch-1 into master (IE11 fix) (#3) (#361)

* Prototype for fetch API support

Proposal/concept for #348

This solution detects the availability of the `fetch` API and patches is in such a way that allows us to inspect the response headers for mini profiler headers before resolving the promise to the original promise handler chain.

* Bug fix

Perform a cases insensitive comparison of the header name

* Remove warning per feedback

* Change for..of to es5 loop

diff --git a/lib/html/includes.js b/lib/html/includes.js
index c01688e..7ce227a 100644
--- a/lib/html/includes.js
+++ b/lib/html/includes.js
@@ -604,7 +604,9 @@ var MiniProfiler = (function () {
             return new Promise(function(resolve,reject) {
               __originalFetch(input,init).then(function(response) {
                 // look for x-mini-profile-ids
-                for (var pair of response.headers.entries()) {
+                var entries = response.headers.entries();
+                for (var i = 0; i < entries.length; i++) {
+                  var pair = entries[i];
                   if(pair[0] && (pair[0].toLowerCase() == 'x-miniprofiler-ids')) {
                   var ids = JSON.parse(pair[1]);
                     fetchResults(ids);

GitHub