Skip to content

Commit

Permalink
better syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
rlsf committed Mar 4, 2022
1 parent 89945eb commit 56e04b7
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,12 @@ function sanitizeHeaders(options) {

const hasExternalLink = Object.keys(queryObject).some(function (queryParam) {
const values = _.isArray(queryObject[queryParam]) ? queryObject[queryParam] : [queryObject[queryParam]]
const v = values.map(v => {
return values.map(v => {
const qUrl = url.parse(v);

// external link if protocol || host || port is different
return (!!qUrl.host && ( qUrl.protocol !== urlObject.protocol || qUrl.host !== urlObject.host || qUrl.port !== urlObject.port) );
})
return v.some(v => v === true)
}).some(v => v === true)
});

if (hasExternalLink && options.hasOwnProperty("headers") && typeof (options.headers) === "object") {
Expand Down

0 comments on commit 56e04b7

Please sign in to comment.