mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-10-16 21:02:57 +08:00
fix: object got query, close #2824
This commit is contained in:
+9
-1
@@ -38,7 +38,15 @@ const custom = got.extend({
|
||||
options.query = options.query || queryString.stringify(options.params);
|
||||
}
|
||||
if (options.query) {
|
||||
options.query = options.query.replace(/([\u4e00-\u9fa5])/g, (str) => encodeURIComponent(str));
|
||||
if (typeof options.query === 'string') {
|
||||
options.query = options.query.replace(/([\u4e00-\u9fa5])/g, (str) => encodeURIComponent(str));
|
||||
} else if (typeof options.query === 'object') {
|
||||
for (const key in options.query) {
|
||||
if (typeof options.query[key] === 'string') {
|
||||
options.query[key] = options.query[key].replace(/([\u4e00-\u9fa5])/g, (str) => encodeURIComponent(str));
|
||||
}
|
||||
}
|
||||
}
|
||||
options.searchParams = options.query; // for Got v11 after
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user