amaurel/json_web_token — pull request #2 by ovangle (2014-04-12 15:38:07+00:00)
Title: Improved error handling

If an error response occurs, throw an appropriate error message.

The json returned in an error looks like

{
"error": error_code
"error_description": error_description
}

When testing the behaviour, a JSON parse error was thrown because the first couple of bytes in the response were returned seperately from the rest of the message. The JSON parsed successfully if the bytes in the stream were concatenated together.