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

'{}' is invalid JSON #338

Open
lolpez opened this issue Jan 27, 2020 · 1 comment
Open

'{}' is invalid JSON #338

lolpez opened this issue Jan 27, 2020 · 1 comment

Comments

@lolpez
Copy link

lolpez commented Jan 27, 2020

I have an API which returns as response '{}' when a method DELETE worked.
image

However when using the option json: true, I get the following error:
'400 - {"err":"Invalid json","ECODE":"JSON_001"}'
image

The option is supposed to parse the response body as JSON so I should get an empty object as response {}.

I believe when JSON parsing '{}' returns {} which is valid.
image

Why is this happening?

@lolpez lolpez changed the title '{}' converting to Json is invalid '{}' is invalid JSON Jan 27, 2020
@analog-nico
Copy link
Member

What you have here is actually not related to the response but instead you get a 400 status code from your API. That means that the JSON in your request is wrong. Please double check your data variable.

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

No branches or pull requests

2 participants