whatwg-fetch
Advanced tools
Comparing version 0.8.2 to 0.9.0
29
fetch.js
@@ -28,14 +28,11 @@ (function() { | ||
var self = this | ||
if (headers instanceof Headers) { | ||
headers.forEach(function(name, values) { | ||
values.forEach(function(value) { | ||
self.append(name, value) | ||
}) | ||
}) | ||
headers.forEach(function(value, name) { | ||
this.append(name, value) | ||
}, this) | ||
} else if (headers) { | ||
Object.getOwnPropertyNames(headers).forEach(function(name) { | ||
self.append(name, headers[name]) | ||
}) | ||
this.append(name, headers[name]) | ||
}, this) | ||
} | ||
@@ -76,8 +73,8 @@ } | ||
// Instead of iterable for now. | ||
Headers.prototype.forEach = function(callback) { | ||
var self = this | ||
Headers.prototype.forEach = function(callback, thisArg) { | ||
Object.getOwnPropertyNames(this.map).forEach(function(name) { | ||
callback(name, self.map[name]) | ||
}) | ||
this.map[name].forEach(function(value) { | ||
callback.call(thisArg, value, name, this) | ||
}, this) | ||
}, this) | ||
} | ||
@@ -327,6 +324,4 @@ | ||
request.headers.forEach(function(name, values) { | ||
values.forEach(function(value) { | ||
xhr.setRequestHeader(name, value) | ||
}) | ||
request.headers.forEach(function(value, name) { | ||
xhr.setRequestHeader(name, value) | ||
}) | ||
@@ -333,0 +328,0 @@ |
{ | ||
"name": "whatwg-fetch", | ||
"version": "0.8.2", | ||
"version": "0.9.0", | ||
"main": "fetch.js", | ||
@@ -5,0 +5,0 @@ "repository": "github/fetch", |
13904
277