Completely updated React, fixed #11, (hopefully)
This commit is contained in:
4
goTorrentWebUI/node_modules/superagent/lib/client.js
generated
vendored
4
goTorrentWebUI/node_modules/superagent/lib/client.js
generated
vendored
@@ -243,7 +243,9 @@ function parseHeader(str) {
|
||||
*/
|
||||
|
||||
function isJSON(mime) {
|
||||
return /[\/+]json\b/.test(mime);
|
||||
// should match /json or +json
|
||||
// but not /json-seq
|
||||
return /[\/+]json($|[^-\w])/.test(mime);
|
||||
}
|
||||
|
||||
/**
|
||||
|
27
goTorrentWebUI/node_modules/superagent/lib/node/index.js
generated
vendored
27
goTorrentWebUI/node_modules/superagent/lib/node/index.js
generated
vendored
@@ -164,7 +164,7 @@ RequestBase(Request.prototype);
|
||||
*
|
||||
* ``` js
|
||||
* request.post('http://localhost/upload')
|
||||
* .attach(new Buffer('<b>Hello world</b>'), 'hello.html')
|
||||
* .attach('field', Buffer.from('<b>Hello world</b>'), 'hello.html')
|
||||
* .end(callback);
|
||||
* ```
|
||||
*
|
||||
@@ -688,20 +688,23 @@ Request.prototype.callback = function(err, res){
|
||||
|
||||
if (!err) {
|
||||
try {
|
||||
if (this._isResponseOK(res)) {
|
||||
return fn(err, res);
|
||||
if (!this._isResponseOK(res)) {
|
||||
let msg = 'Unsuccessful HTTP response';
|
||||
if (res) {
|
||||
msg = http.STATUS_CODES[res.status] || msg;
|
||||
}
|
||||
err = new Error(msg);
|
||||
err.status = res ? res.status : undefined;
|
||||
}
|
||||
|
||||
let msg = 'Unsuccessful HTTP response';
|
||||
if (res) {
|
||||
msg = http.STATUS_CODES[res.status] || msg;
|
||||
}
|
||||
err = new Error(msg);
|
||||
err.status = res ? res.status : undefined;
|
||||
} catch (new_err) {
|
||||
err = new_err;
|
||||
}
|
||||
}
|
||||
// It's important that the callback is called outside try/catch
|
||||
// to avoid double callback
|
||||
if (!err) {
|
||||
return fn(null, res);
|
||||
}
|
||||
|
||||
err.response = res;
|
||||
if (this._maxRetries) err.retries = this._retries - 1;
|
||||
@@ -1064,7 +1067,9 @@ function isImageOrVideo(mime) {
|
||||
*/
|
||||
|
||||
function isJSON(mime) {
|
||||
return /[\/+]json\b/.test(mime);
|
||||
// should match /json or +json
|
||||
// but not /json-seq
|
||||
return /[\/+]json($|[^-\w])/.test(mime);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user