Add support for options.headers in m.request + tests/docs
I also had to edit the mocks accordingly, so I could inspect the headers set.
This commit is contained in:
parent
00a3ce3657
commit
95d738bc71
4 changed files with 66 additions and 5 deletions
|
|
@ -14,7 +14,13 @@ module.exports = function() {
|
|||
var $window = {
|
||||
XMLHttpRequest: function XMLHttpRequest() {
|
||||
var args = {}
|
||||
this.setRequestHeader = function(header, value) {}
|
||||
var headers = {}
|
||||
this.setRequestHeader = function(header, value) {
|
||||
headers[header] = value
|
||||
}
|
||||
this.getRequestHeader = function(header) {
|
||||
return headers[header]
|
||||
}
|
||||
this.open = function(method, url, async, user, password) {
|
||||
var urlData = parseURL(url, {protocol: "http:", hostname: "localhost", port: "", pathname: "/"})
|
||||
args.method = method
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue