-
Notifications
You must be signed in to change notification settings - Fork 24
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(Request): support custom "credentials" value #21
Conversation
|
I will leave the changeset/version bump decision up to the maintainers. It should be a patch release, if you ask me. |
Hey, @jacob-ebey 👋 Sorry for the direct ping. May I please ask you to look at this change? It's small but it would unblock me greatly with some of my open-source work. It'd also improve specification compliance of this polyfill, so everyone wins. I would really appreciate your review on this. |
I also confirm that this is indeed the missing piece for my work. Here the state of tests once I build and link this fix in my package:
|
I believe I'm ok with this change. The issue I have is that credentials have cascading effects that are not currently handled in this implementation: https://fetch.spec.whatwg.org/ I'm going to have to review the spec more and make sure this doesn't have any huge pitfalls before I can commit to merging this. |
@jacob-ebey, thank you for the initial review. I may propose another motivation behind this is that in the current form the But I understand that respecting the credentials, while bringing this implementation closer to the spec, may open some new issues where the credentials-derived implementation may be missing. If you need any help with implementing any dependent things you discover just let me know. A big chunk of my work depends on this change so I'm open to making these improvements happen. |
I've read through the spec and sharing some of my thoughts below. What
|
Hey, @jacob-ebey. I really hate to disturb you regarding this change, may I ask you if I can help you somehow to move this forward? You can find my read of the Fetch API spec in the comment above. As I've said, you have my assistance with this because I need this change to unblock a major improvement in one of the libraries I maintain. Thanks! |
- Follow-up to remix-run/web-std-io#21 - Related to mswjs/msw#1436
* fix(Request): support custom "credentials" value (remix-run#21) * Create soft-gorillas-travel.md * Update soft-gorillas-travel.md * chore: fix changeset --------- Co-authored-by: Artem Zakharchenko <kettanaito@gmail.com> Co-authored-by: Jacob Ebey <jacob.ebey@live.com>
Motivation
I'm adopting this polyfill as a part of a large API change in Mock Service Worker to adhere better to the Fetch API specification (mswjs/interceptors#292, part of mswjs/msw#1404). While doing so, I've spotted that whenever I construct a
Request
instance, itscredentials
are always set tosame-origin
, ignoring any custom credentials value I may supply in request init.It's absolutely possible and allowed to construct a Request instance with any credentials the consumer needs.
Changes
credentials
toRequestState
Request.credentials
getter to resolve the value from the internal state.