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
Getting Null on Patch Requests #66
Comments
Are you setting the request's Content-Type as "application/json-patch+json"? |
I had this same issue. Make sure that the JSON body of your request is formatted correctly. I was using RestSharp, which serializes using a formatter that doesn't respect the [SerializeAs] attributes on JsonPatchDocument. Using fiddler I was able to see what was being passed in the request body and with Insomnia I could confirm that it didn't work. By serializing with Newtsoft.Json, I got out put that looked like the json patch RFC. |
Closing issue as it seems to be solved. If you experience additional problems, feel free to reopen. |
How this was resolved? I have the same problem. Here's signature of my api method
and here my simple JSONPatch sent by restlet client.
Any help on this? Thanks, |
I solved by myself.
works like a charm. Daniele |
Thanks. Bad code Fixed code |
Hello,
Is there anything special I need to do other than adding the Nuget Package and using the JsonPatchDocument on the [FromBody] attribute for the HttpPatch methods on Web API? For some reason, no matter what I do, I always get a null object. Here's how my call looks like:
I am using ASP.NET Web API (not on ASP.NET Core). Any help would be appreciated.
Anup
The text was updated successfully, but these errors were encountered: