Skip to content
This repository was archived by the owner on Dec 20, 2025. It is now read-only.

refactor(google-sr): use utf-8 to decode http response - #95

Merged
typicalninja merged 6 commits into
masterfrom
utf-8-patch
Jul 27, 2025
Merged

refactor(google-sr): use utf-8 to decode http response#95
typicalninja merged 6 commits into
masterfrom
utf-8-patch

Conversation

@typicalninja

@typicalninja typicalninja commented Jul 27, 2025

Copy link
Copy Markdown
Owner

In #75, when we replaced axios with native fetch we were getting ISO-8859-1 encoded text for the user-agent we used. with further experimentation I was able to make google send UTF-8 encoded text via an IE 9 user-agent. additionally, the user-agent mentioned in the google-sr-selectors README was updated to the new one we use to prevent confusion.

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.
@changeset-bot

changeset-bot Bot commented Jul 27, 2025

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 56420b9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jul 27, 2025

Copy link
Copy Markdown
npm i https://pkg.pr.new/google-sr@95
npm i https://pkg.pr.new/google-sr-selectors@95
npm i https://pkg.pr.new/google-that@95

commit: 56420b9

@codecov

codecov Bot commented Jul 27, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.40%. Comparing base (6c08082) to head (56420b9).
⚠️ Report is 5 commits behind head on master.
✅ All tests successful. No failed tests found.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@typicalninja
typicalninja merged commit b6d8c9e into master Jul 27, 2025
12 checks passed
@typicalninja
typicalninja deleted the utf-8-patch branch July 27, 2025 17:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant