-
Notifications
You must be signed in to change notification settings - Fork 29
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
Uncaught SyntaxError: Unexpected token a #44
Comments
something like this would happen when you have the "application/json" mime type selected, but your API that you are requesting is returning borked JSON. look into the api you are polling from.. take the result and put it through http://jsonlint.com. you'll see that it's malformed JSON. |
no the problem is actually in the payload parsing. If the payload is not a valid JSON, it breaks and gives me this error. API is fine. API is not even called. It breaks before that. Can't we can have a graceful warning saying that the payload is invalid or something instead of this long error. |
could you tell me the method you are using? I tried doing a POST request using |
method i am using is "application/json". My payload was {somekey:"somevalue"}. So the quotes were missing around the keys. As soon as I got the quotes wrapped, it worked. There is one more issue. Saved searches just disappear next day! Maybe I should open another issue for the same. |
We should return a human message if the json is not correct in the response |
Fix wrong json payload error, close #44
[Enter steps to reproduce below:]
Atom Version: 1.8.0
System: Mac OS X 10.11.5
Thrown From: rest-client package, v1.2.0
Stack Trace
Uncaught SyntaxError: Unexpected token a
Commands
Config
Installed Packages
The text was updated successfully, but these errors were encountered: