refactor(google-sr): use utf-8 to decode http response - #95
Conversation
Bit more modern browser.
The default headers have been updated to be a bit more modern while still forcing google to serve a non-js page. decodeResponse functio is not longer needed as <response>.text will decode utf-8 fine.
For some reason, the link format google sends for the previous user agent differs from the one sent for IE 9 user agent. this fixes the regex to capture the new variant
While the previous user-agent worked for these selectors, imo its betters to use the user-agent we are using in google-sr to prevent confusion.
|
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #95 +/- ##
==========================================
- Coverage 98.41% 98.40% -0.02%
==========================================
Files 12 12
Lines 506 502 -4
Branches 107 106 -1
==========================================
- Hits 498 494 -4
Misses 8 8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
In #75, when we replaced
axioswith native fetch we were gettingISO-8859-1encoded text for the user-agent we used. with further experimentation I was able to make google sendUTF-8encoded text via anIE 9user-agent. additionally, the user-agent mentioned in thegoogle-sr-selectorsREADME was updated to the new one we use to prevent confusion.