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

[typescript-fetch] Allow fetch to be passed in configuration #2642

Closed
djMax opened this issue Apr 10, 2019 · 2 comments
Closed

[typescript-fetch] Allow fetch to be passed in configuration #2642

djMax opened this issue Apr 10, 2019 · 2 comments

Comments

@djMax
Copy link

djMax commented Apr 10, 2019

When generating typescript-fetch code, I would like to be able to pass in a single argument to the various API constructors/methods that covered all the options, INCLUDING the fetch function. Our use case is to automatically inject various metrics and headers to outgoing requests and incoming responses, and they are "per instance." So overriding fetch is great, BUT, it means if I want to create a client with these overrides, I need to do:

new PetsApi(...myCustomSettings)

That function takes three arguments now - config, fetch, and basePath. It already allows basePath to be passed into the config, so I'm suggesting that fetch is also allowed to be passed into the config. PR forthcoming if I can grok it.

@auto-labeler
Copy link

auto-labeler bot commented Apr 10, 2019

👍 Thanks for opening this issue!
🏷 I have applied any labels matching special text in your issue.

The team will review the labels and make any necessary changes.

@djMax
Copy link
Author

djMax commented Apr 10, 2019

Never mind, I see that 4.0 is a major refactor that has middleware that likely does exactly this. Still trying to read through it and then try it to verify, but guidance appreciated.

@djMax djMax closed this as completed Apr 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant