Skip to content

Commit

Permalink
fix: fix error when no message body is reported
Browse files Browse the repository at this point in the history
  • Loading branch information
idranme committed Jul 24, 2024
1 parent 83bbf8c commit e8326db
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ export class HTTP extends Service<HTTP.Config> {
defaultDecoder(response: Response) {
const type = response.headers.get('Content-Type')
if (type?.startsWith('application/json')) {
if (response.headers.get('Content-Length') === '0') {
return new Promise(resolve => resolve({}))
}
return response.json()
} else if (type?.startsWith('text/')) {
return response.text()
Expand Down

0 comments on commit e8326db

Please sign in to comment.