-
-
Notifications
You must be signed in to change notification settings - Fork 611
Open
Labels
enhancementNew feature or requestNew feature or requestopenapi-fetchRelevant to the openapi-fetch libraryRelevant to the openapi-fetch library
Description
Description
I have a web client that is currently using openapi-fetch to make a POST API call. I would like to modify it to make that request via navigator.sendBeacon instead. See the docs there for a description of the circumstance in which this is useful.
Proposal
If is isn't desirable to make a code change to support a browser-specific API, merely making a documentation improvement might be sufficient to pave the path here. I think it suffices to provide as an argument to createClient something like
fetch: async (input: Request) => {
window.navigator.sendBeacon(input.url, input.body)
return new Response('') // sendBeacon doesn't return a response
}Does this seem like a smart enough way to go about it?
Extra
- I’m willing to open a PR (see CONTRIBUTING.md)
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestopenapi-fetchRelevant to the openapi-fetch libraryRelevant to the openapi-fetch library