mirror of
https://github.com/Wessel/wumpfetch.git
synced 2026-07-18 06:13:56 +02:00
Add chaining option and update README
This commit is contained in:
@@ -23,7 +23,8 @@ module.exports = class WumpRequest {
|
||||
'url': typeof url === 'string' ? new u.URL(url) : obj && typeof o.url === 'string' ? new u.URL(o.url) : url,
|
||||
'SDA': obj && typeof o.sendDataAs === 'string' ? o.sendDataAs : obj && o.data && typeof o.data === 'object' ? 'json' : undefined,
|
||||
'data': obj && o.body ? o.body : obj && o.data ? o.data : obj && o.json ? o.json : obj && o.form ? qs.stringify(o.form) : undefined,
|
||||
'parse': obj && o.parse ? o.parse : undefined,
|
||||
'parse': obj && o.parse ? o.parse : undefined,
|
||||
'chain': !!(obj && o.chaining),
|
||||
'follow': !!(obj && o.followRedirects),
|
||||
'rHeaders': obj && typeof o.headers === 'object' ? o.headers : {},
|
||||
'streamed': !!(obj && o.streamed),
|
||||
@@ -34,8 +35,10 @@ module.exports = class WumpRequest {
|
||||
|
||||
if (typeof o.core === 'object') Object.keys(o.core).forEach((v) => this.option(v, o.core[v]));
|
||||
|
||||
if (!this.o.chain) return this.send();
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
query (a, b) {
|
||||
if (typeof a === 'object') Object.keys(a).forEach((v) => this.o.url.searchParams.append(v, a[v]));
|
||||
|
||||
Reference in New Issue
Block a user