mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
feat: auto add headers.host
This commit is contained in:
@@ -100,11 +100,15 @@ const requestWrapper = (url, options) => {
|
||||
options.headers.server = 'RSSHub';
|
||||
|
||||
try {
|
||||
const urlHandler = new URL(url);
|
||||
// referer
|
||||
if (!options.headers.referer && !options.headers.Referer) {
|
||||
const urlHandler = new URL(url);
|
||||
options.headers.referer = urlHandler.origin;
|
||||
}
|
||||
// host
|
||||
if (!options.headers.host && !options.headers.Host) {
|
||||
options.headers.host = urlHandler.host;
|
||||
}
|
||||
} catch (e) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user