mirror of
https://github.com/Wessel/wumpfetch.git
synced 2026-07-16 13:33:37 +02:00
Fixed hopefully
This commit is contained in:
@@ -23,7 +23,7 @@ module.exports = class WumpRequest {
|
||||
'm': typeof o === 'string' ? o : obj && o.method ? o.method : 'GET',
|
||||
'url': typeof url === 'string' ? new URL(url) : obj && typeof o.url === 'string' ? new URL(o.url) : url,
|
||||
'SDA': obj && typeof o.sendDataAs === 'string' ? o.sendDataAs : obj && o.data && typeof o.data === 'object' ? 'json' : undefined,
|
||||
'data': obj && o.data ? o.data : obj && o.json ? o.json : obj && o.form ? stringify(o.form) : undefined,
|
||||
'data': obj && o.body ? o.body : obj && o.data ? o.data : obj && o.json ? o.json : obj && o.form ? stringify(o.form) : undefined,
|
||||
'parse': obj && o.parse ? o.parse : undefined,
|
||||
'follow': !!(obj && o.followRedirects),
|
||||
'rHeaders': obj && typeof o.headers === 'object' ? o.headers : {},
|
||||
@@ -95,7 +95,7 @@ module.exports = class WumpRequest {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (this.o.data) {
|
||||
if (!this.o.rHeaders.hasOwnProperty('user-agent')) {
|
||||
this.o.rHeaders['User-Agent'] = w.userAgent;
|
||||
this.o.rHeaders['User-Agent'] = w.userAgent || 'Wumpfetch/2.0.1 (https://github.com/PassTheWessel/wumpfetch)';
|
||||
}
|
||||
|
||||
if (this.o.SDA === 'json' && !this.o.rHeaders.hasOwnProperty('content-type')) this.o.rHeaders['Content-Type'] = 'application/json';
|
||||
|
||||
Reference in New Issue
Block a user