fixed
parent
ae80130dea
commit
0e5c353fbb
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@bytedo/fetch",
|
"name": "@bytedo/fetch",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"description": "全新的ajax封装。分2个版本, 一个基于XMLHttpRequest, 一个基于window.fetch",
|
"description": "全新的ajax封装。分2个版本, 一个基于XMLHttpRequest, 一个基于window.fetch",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
|
|
|
@ -77,11 +77,18 @@ class _Request {
|
||||||
control.abort()
|
control.abort()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (__INIT__.headers && options.headers) {
|
var headers = this.options.headers
|
||||||
Object.assign(__INIT__.headers, options.headers)
|
|
||||||
|
if (__INIT__.headers) {
|
||||||
|
Object.assign(headers, __INIT__.headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.assign(this.options, __INIT__, options, { url })
|
if (options.headers) {
|
||||||
|
Object.assign(headers, options.headers)
|
||||||
|
delete options.headers
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.assign(this.options, __INIT__, options, { url, headers })
|
||||||
|
|
||||||
this.__next__()
|
this.__next__()
|
||||||
return this.defer.promise
|
return this.defer.promise
|
||||||
|
|
13
src/next.es7
13
src/next.es7
|
@ -50,11 +50,18 @@ class _Request {
|
||||||
options.signal = this.control.signal
|
options.signal = this.control.signal
|
||||||
}
|
}
|
||||||
|
|
||||||
if (__INIT__.headers && options.headers) {
|
var headers = this.options.headers
|
||||||
Object.assign(__INIT__.headers, options.headers)
|
|
||||||
|
if (__INIT__.headers) {
|
||||||
|
Object.assign(headers, __INIT__.headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.assign(this.options, __INIT__, options, { url })
|
if (options.headers) {
|
||||||
|
Object.assign(headers, options.headers)
|
||||||
|
delete options.headers
|
||||||
|
}
|
||||||
|
|
||||||
|
Object.assign(this.options, __INIT__, options, { url, headers })
|
||||||
|
|
||||||
return this.__next__()
|
return this.__next__()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue