[UseFetch and CreateFetch] Forward all options to fetch rather than few options
hungify opened this issue · comments
hungify commented
I am attempting to utilize the openapi-fetch
library with useFetch
to exploit their combined features.
I am having trouble using openapi-fetch
with useFetch
as it doesn't forward all param options to custom fetch.
if (args.length > 1 && isFetchOptions(args[1]))
options = { ...options, ...args[1] }
// `options` contains my custom properties but it doesn't forward to fetch
const { fetch = window?.fetch, initialData, timeout } = options
return fetch(context.url, {
...defaultFetchOptions,
...context.options,
headers: {
...headersToObject(defaultFetchOptions.headers),
...headersToObject(context.options?.headers),
},
})
Suggested solution
I suggest that useFetch should forward all fetch options like useFetch in Nuxt.
Alternative
No response
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.