fix(useFetch): generated payloadType on execute #3251
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before submitting the PR, please make sure you do the following
fixes #123
).Description
close #3250
Additional context
🤖 Generated by Copilot at f85bdf3
Improved the handling of different payload types and headers in
useFetch
and added tests to verify the functionality. Refactored the code to avoid duplication and ensure consistency.🤖 Generated by Copilot at f85bdf3
useFetch
function, to ensure consistency and avoid duplication (link, link)json
to excludeFormData
instances, since they are handled byfetch
without specifying the header (link)useFetch
with different types of payloads (JSON and FormData) and how the Content-Type header is set accordingly (link)ref
function from Vue to create reactive values for the payload and theretry
function from the test utils to wait for the fetch call to complete and assert the expected header value in the test cases (link)