Skip to content
This repository has been archived by the owner on Nov 9, 2023. It is now read-only.

Consider not mutating provided opts object #32

Closed
celayale opened this issue Jun 7, 2019 · 3 comments
Closed

Consider not mutating provided opts object #32

celayale opened this issue Jun 7, 2019 · 3 comments

Comments

@celayale
Copy link

celayale commented Jun 7, 2019

We are facing an issue when migrating from node-fetch to @zeit/fetch due to the fact that some of the properties in provided opts object are mutated before calling the decorated fetch function.

We are having issues mainly with headers, but I see the body is overwritten too.

Maybe it would be a good idea to copy provided opts and mutate the copy before passing to the wrapped fetch instead? It would remove these unexpected side effects.

I think I could try to provide the fix if you are ok with it.

@celayale
Copy link
Author

celayale commented Jun 7, 2019

The implementation would be quite simple. Let me know if you want me to create the PR.

https://github.com/zeit/fetch/compare/master...celayale:feature/avoid-mutating-opts?expand=1

@cgimeno
Copy link

cgimeno commented Jun 10, 2019

+1

@Ethan-Arrowood
Copy link
Collaborator

Thank you for the report. We are archiving this project; you can read more details here: #83

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants