Skip to content

Commit

Permalink
Handle empty bodies.
Browse files Browse the repository at this point in the history
  • Loading branch information
wparad committed Dec 14, 2023
1 parent 46c9290 commit cd0d1c6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/httpClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class HttpClient {
url,
headers: response.headers,
status: response.status,
data: await response.json()
data: await response.json().catch(e => e) || {}
};
} catch (error) {
const resolvedError = typeof error.json === 'function' ? await error.json().catch(e => e) : error;
Expand Down

0 comments on commit cd0d1c6

Please sign in to comment.