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

feat(fetch): add Request{Init}.duplex and add WPTs #1681

Merged
merged 2 commits into from Oct 4, 2022

Conversation

KhafraDev
Copy link
Member

  • Adds Request.duplex and RequestInit.duplex
  • Handles title attributes in META tags.
  • Better expected fails - only fails tests in a file with the test name now. Can also be adjusted to allow skipping entire files, etc. in the future (similar to node core).
  • Most importantly, fixes an issue with using a dynamic import that would cause multiple test(...) functions to fail due to the internal state being set. I could not tell you why this happened.

Both tests that were added to the expected fails could likely be fixed, but I haven't looked into it.

@codecov-commenter
Copy link

codecov-commenter commented Oct 4, 2022

Codecov Report

Base: 94.26% // Head: 94.25% // Decreases project coverage by -0.01% ⚠️

Coverage data is based on head (7e77eb5) compared to base (0964a83).
Patch coverage: 33.33% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1681      +/-   ##
==========================================
- Coverage   94.26%   94.25%   -0.02%     
==========================================
  Files          53       53              
  Lines        4884     4887       +3     
==========================================
+ Hits         4604     4606       +2     
- Misses        280      281       +1     
Impacted Files Coverage Δ
lib/fetch/request.js 85.08% <33.33%> (-0.23%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@benmccann
Copy link
Contributor

This appears to be causing a regression. We got a report that requests in SvelteKit are now failing: sveltejs/kit#7409. It seems that the duplex field is now required. Someone has proposed always providing it in SvelteKit requests though that does not seem correct to me: sveltejs/kit#7412

@mcollina
Copy link
Member

can you open a new issue to track the regression, ideally with a repro?

@KhafraDev
Copy link
Member Author

KhafraDev commented Oct 27, 2022

This is part of the spec now. When you have a ReadableStream body, the duplex option is required.

edit: as mentioned in issue, see this: whatwg/fetch@edf07e5#diff-b4827ee42aceaf9dc3e7216f72262d81c32217e9996fb70a657f259e3ac92604R6898-R6899

@KhafraDev KhafraDev deleted the request-wpts branch October 27, 2022 21:08
@benmccann
Copy link
Contributor

Thanks! We'll get SvelteKit updated. I wonder if this should have been a major release as it's a breaking change?

@KhafraDev
Copy link
Member Author

Fetch in undici and node core are both considered experimental, so breaking changes should be expected.

See https://github.com/nodejs/undici#undicifetchinput-init-promise and https://nodejs.org/dist/latest-v18.x/docs/api/all.html#all_globals_fetch

It would likely be a good idea to pin undici's version and do manual updates to ensure nothing breaks between versions

@KhafraDev KhafraDev mentioned this pull request Oct 27, 2022
metcoder95 pushed a commit to metcoder95/undici that referenced this pull request Dec 26, 2022
* feat(fetch): add `Request.duplex` and add WPTs

* feat: add remaining applicable tests
crysmags pushed a commit to crysmags/undici that referenced this pull request Feb 27, 2024
* feat(fetch): add `Request.duplex` and add WPTs

* feat: add remaining applicable tests
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.

None yet

5 participants