Closed rmtsrc closed 3 years ago
Sometimes a server will respond with a "content-type": "application/json" header, but sends text or invalid JSON in the body.
"content-type": "application/json"
In this case I was receiving an error from talkback: Error handling request SyntaxError: Unexpected token e in JSON at position 0
Error handling request SyntaxError: Unexpected token e in JSON at position 0
This PR tries to parse the response as JSON first, if it fails fallback to the rawBody.
rawBody
Thank you @SebFlippence. v2.4.1 contains this fix.
Sometimes a server will respond with a
"content-type": "application/json"
header, but sends text or invalid JSON in the body.In this case I was receiving an error from talkback:
Error handling request SyntaxError: Unexpected token e in JSON at position 0
This PR tries to parse the response as JSON first, if it fails fallback to the
rawBody
.