Fix inflexible/slightly broken m.request tests

This commit is contained in:
impinball 2015-12-16 13:33:34 -05:00
parent 7f7a0a3815
commit c21566366e
3 changed files with 27 additions and 4 deletions

View file

@ -227,6 +227,14 @@ this.mock = (function (global) {
function Request() {
this.$headers = {}
this.$resolve = function (data, status) {
if (data === undefined) data = this // eslint-disable-line
this.responseText = JSON.stringify(data)
this.readyState = 4
this.status = status || 200
return this
}
this.setRequestHeader = function (key, value) {
this.$headers[key] = value
}
@ -237,9 +245,6 @@ this.mock = (function (global) {
}
this.send = function () {
this.responseText = JSON.stringify(this)
this.readyState = 4
this.status = 200
Request.$instances.push(this)
}
}