Skip to content

Response type #244

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

Merged
merged 8 commits into from
Apr 17, 2020
Merged

Response type #244

merged 8 commits into from
Apr 17, 2020

Conversation

iamthesiz
Copy link
Collaborator

@iamthesiz iamthesiz commented Apr 16, 2020

Adding responseType option.

// makes it internally do `response.json()`
const { data } = useFetch({ responseType: 'json' })

By default it's set to ['json', 'text', 'blob', 'readableStream'] and it will attempt to set the data field by going through each of these response types in order. If the json fails, it will try text and so on.

@iamthesiz iamthesiz marked this pull request as draft April 16, 2020 07:09
@iamthesiz iamthesiz marked this pull request as ready for review April 17, 2020 01:37
@iamthesiz iamthesiz merged commit 2850f53 into master Apr 17, 2020
@iamthesiz iamthesiz deleted the responseType branch April 17, 2020 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant