Skip to content
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

Fix fetch/Request #161

Merged
merged 2 commits into from
Jul 4, 2024
Merged

Fix fetch/Request #161

merged 2 commits into from
Jul 4, 2024

Conversation

ikreymer
Copy link
Member

@ikreymer ikreymer commented Jul 4, 2024

  • Fix fetch(request) override and Request constructor to properly apply RequestInit overrides.
  • Add __WB_real_url to Request to detect an overridden request and not create a new one.
  • Update fetch() tests to be more correct.

- correctly handle Request(<rewritten url>, <original request>) init if needed (if url needs to be rewritten)
- store __WB_real_url on Request object to be able to tell if we have a rewritten request to avoid second rewrite

worker rewrite:
- use JSON.stringify() to avoid possible quote issues in rw prefix
fix tests for fetch / Request
@ikreymer ikreymer merged commit f67fd5d into main Jul 4, 2024
4 checks passed
@ikreymer ikreymer deleted the fix-fetch branch July 4, 2024 17:55
ikreymer added a commit that referenced this pull request Jul 5, 2024
- add __WB_no_unrewrite option to get original url / referrer
- avoids storing extra real URL, extra copying of RequestInit object
- simplifies Request override, avoids copying props (fixes body not being copied)
ikreymer added a commit that referenced this pull request Jul 5, 2024
- add __WB_no_unrewrite option to get original url / referrer
- avoids storing extra real URL, extra copying of RequestInit object
- simplifies Request override, avoids copying props (fixes body not being copied)
ikreymer added a commit that referenced this pull request Jul 5, 2024
- add __WB_no_unrewrite option to get original url / referrer
- avoids storing extra real URL, extra copying of RequestInit object
- simplifies Request override, avoids copying props (fixes body not being copied)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant