Skip to content

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