Skip to content
This repository was archived by the owner on Apr 26, 2022. It is now read-only.

Commit 5945dba

Browse files
author
Matt Foyle
authored
fix: Don't attempt to parse body on 204 response (#97)
* Currently the library will return an error if a 204 no content response is returned from the API. It does this because it immediately tries to parse a JSON response. This change ensures that if the response code is a 204, no parsing attempt is made, and any response text is still returned. * Update src/index.ts Co-Authored-By: matthew1809 <[email protected]> * Update src/index.ts Co-Authored-By: matthew1809 <[email protected]>
1 parent cb9f837 commit 5945dba

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ export class createClient {
9292
...(data && body)
9393
})
9494

95+
if (response.status === 204)
96+
return response.text()
97+
9598
const json = await response.json()
9699

97100
if (!response.ok) {

0 commit comments

Comments
 (0)