Skip to content

Error while decoding JSON on empty responses #11

Open
@brendon-codes

Description

@brendon-codes

If decodeJSON is set to true in a request, and the response has a status code of 200 with empty response, I am getting this error:

Unhandled rejection SyntaxError: Unexpected end of input
    at Object.parse (native)
    at /FOOBAR/node_modules/bhttp/lib/bhttp.js:546:38
    at ConcatStream.<anonymous> (/FOOBAR/node_modules/bhttp/node_modules/concat-stream/index.js:36:43)
    at emitNone (events.js:72:20)
    at ConcatStream.emit (events.js:166:7)
    at finishMaybe (/FOOBAR/node_modules/bhttp/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:502:14)
    at endWritable (/FOOBAR/node_modules/bhttp/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:512:3)
    at ConcatStream.Writable.end (/FOOBAR/node_modules/bhttp/node_modules/concat-stream/node_modules/readable-stream/lib/_stream_writable.js:477:5)
    at IncomingMessage.onend (_stream_readable.js:490:10)
    at IncomingMessage.g (events.js:260:16)
    at emitNone (events.js:72:20)
    at IncomingMessage.emit (events.js:166:7)
    at endReadableNT (_stream_readable.js:893:12)
    at doNTCallback2 (node.js:429:9)
    at process._tickCallback (node.js:343:17)

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions