Skip to content

Commit

Permalink
parameters.jsのリファクタ
Browse files Browse the repository at this point in the history
  • Loading branch information
h-sugawara committed Jan 26, 2024
1 parent de13bc8 commit b5ca3a6
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions lib/parameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,14 @@ function findOptionalArgs(opts, find) {
}

function getFetchOptions(isCrawler) {
const fetchOptions = {};
const headers = {
'accept': 'text/html',
const fetchOptions = {
headers: {
'accept': 'text/html',
},
};

if (typeof isCrawler === 'boolean' && isCrawler) {
headers['user-agent'] = CRAWLER_USER_AGENT;
}

if (Object.keys(headers).length !== 0) {
fetchOptions.headers = headers;
fetchOptions.headers['user-agent'] = CRAWLER_USER_AGENT;
}

return fetchOptions;
Expand Down

0 comments on commit b5ca3a6

Please sign in to comment.