Skip to content
This repository was archived by the owner on Mar 10, 2020. It is now read-only.

Commit ac10343

Browse files
committed
Avoid crash for responses without 'content-type' header
1 parent 2e67784 commit ac10343

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/request-api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function onRes (buffer, cb) {
2525

2626
const stream = !!res.headers['x-stream-output']
2727
const chunkedObjects = !!res.headers['x-chunked-output']
28-
const isJson = res.headers['content-type'].indexOf('application/json') === 0
28+
const isJson = res.headers['content-type'] && res.headers['content-type'].indexOf('application/json') === 0
2929

3030
if (res.statusCode >= 400 || !res.statusCode) {
3131
const error = new Error(`Server responded with ${res.statusCode}`)

0 commit comments

Comments
 (0)