mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-08 14:07:54 +08:00
chore: bump got from 9.x to 10.x (#3875)
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
const logger = require('./logger');
|
||||
const config = require('@/config').value;
|
||||
const got = require('got');
|
||||
const queryString = require('query-string');
|
||||
|
||||
const custom = got.extend({
|
||||
retry: {
|
||||
retries: config.requestRetry,
|
||||
limit: config.requestRetry,
|
||||
statusCodes: [408, 413, 429, 500, 502, 503, 504, 404], // add 404 to default for unit test
|
||||
},
|
||||
hooks: {
|
||||
@@ -31,18 +30,6 @@ const custom = got.extend({
|
||||
if (options.data) {
|
||||
options.body = options.body || options.data;
|
||||
}
|
||||
if (options.responseType === 'buffer') {
|
||||
options.encoding = null;
|
||||
}
|
||||
if (options.params) {
|
||||
options.query = options.query || queryString.stringify(options.params);
|
||||
}
|
||||
if (options.query) {
|
||||
options.searchParams = options.query; // for Got v11 after
|
||||
}
|
||||
if (options.baseUrl) {
|
||||
options.prefixUrl = options.baseUrl; // for Got next version
|
||||
}
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user