Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Commit

Permalink
allow to set multiple values for a header by passing an array of values
Browse files Browse the repository at this point in the history
  • Loading branch information
Baptouuuu committed Apr 27, 2015
1 parent 4210562 commit 487ee51
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/HTTP/Manager.js
Expand Up @@ -155,7 +155,13 @@ Sy.HTTP.Manager.prototype = Object.create(Object.prototype, {

for (var header in headers) {
if (headers.hasOwnProperty(header)) {
req.xhr.setRequestHeader(header, headers[header]);
if (headers[header] instanceof Array) {
for (var i = 0, l = headers[header].length; i < l; i++) {
req.xhr.setRequestHeader(header, headers[header][i]);
}
} else {
req.xhr.setRequestHeader(header, headers[header]);
}
}
}

Expand Down Expand Up @@ -339,4 +345,4 @@ Sy.HTTP.Manager.prototype = Object.create(Object.prototype, {
}
}

});
});

0 comments on commit 487ee51

Please sign in to comment.