-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIxing HTTP 406 error while runing the test suite (npm test) #96
Conversation
package.json
Outdated
@@ -13,7 +13,8 @@ | |||
"istanbul": "^0.4.5", | |||
"mocha": "^10.3.0", | |||
"mocha-jshint": "^2.3.1", | |||
"mocha-lcov-reporter": "^1.3.0" | |||
"mocha-lcov-reporter": "^1.3.0", | |||
"nock": "^13.3.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's an extra space here
}); | ||
}); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stick to tabs please. (Probably this repo needs some linting added!)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some style stuff (we should add linting so that's automated, sorry!)
Hello @mvolz, I have made the requested changes to the pull request. You can check and if there is still anything I should do, please inform me |
Hello @mvolz would you please do the PR review for the changes made ? |
package.json
Outdated
@@ -51,4 +52,4 @@ | |||
"url": "https://github.com/wikimedia/html-metadata/issues" | |||
}, | |||
"homepage": "https://github.com/wikimedia/html-metadata" | |||
} | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The red circle with the line through it means this file is missing a new line character.
https://stackoverflow.com/questions/729692/why-should-text-files-end-with-a-newline
@mvolz, can you review my PR? I also think a styling lint should be added to help in other future changes. I'm thinking of introducing one to this project. What do you think? |
@mvolz, I guess this PR is done |
This is to fix issue #95
Solution
I modified the
scraping.js
file to use more browser-like User-Agent and Accept headers. Here are the key changes:Added constants for user agent and accept header:
Created a
getWithHeaders
function to make requests with these headers:Updated all
preq.get()
calls to usegetWithHeaders()
instead.Modified the
meta()
function calls to include the headers:This should improve the reliability of the test suite, especially when dealing with websites that have stricter requirements for incoming requests.