Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/correctly handle response chunks to avoid SyntaxError #19

Conversation

mikrofusion
Copy link
Contributor

  • Need to ensure all data is received before trying to run JSON parse or else will end up getting a ‘[SyntaxError: Unexpected token’.
  • Since data might come in chunks need to concatenate the chunks wait for a carriage return / newline before parsing.
  • Also fixed whitespace since CoffeeScript is sensitive to spacing.
  • To make the changes easier to read (due to all the whitespace changes, you can use ?w=1 to the URL to see the diff with whitespace ignored. First commit is code changes, second commit is whitespace.)

@wdalmut
Copy link

wdalmut commented Mar 28, 2015

👍 effectively resolves different problems like invalid characters, spamming, and the invalid token errors

MathildeLemee added a commit that referenced this pull request Mar 28, 2015
…-chunks-to-avoid-syntaxerror

Bug/correctly handle response chunks to avoid SyntaxError
@MathildeLemee MathildeLemee merged commit a4a28cb into MathildeLemee:master Mar 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants