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
'Invalid JSON String' for POST request with application/json content type #851
Comments
I was not able to replicate this issue. Do you have any more information on what you were trying to do? |
So, I found the workaround -- apparently |
I have exactly the same problem:
The above described variations of me, trying to send a raw string to a REST api. Do not work. I am not sure why this is happening. But it basically bars me from using the library. |
Thanks for reporting. I think the request format need to be set more conveniently. |
It is actually all fixed. Use AddJsonBody and both the request format and content type will be set for you |
So I was making a POST request to an endpoint that needs
application\json.
I initialized the RestClient and request and usedrequest.AddHeader("Content-Type","application/json")
and made subsequent calls to
request.AddParameter()
but the error I get isInvalid JSON String
with a status code ofUnsupportedMediaType
and also mentionsexpected application/json or text/json body.
Any idea of what's going on?I tried using a custom serializer as well, but to no avail. The request works successfully on Chrome's Advanced Rest Client.
The text was updated successfully, but these errors were encountered: