I am developing an Azure mobile service that contains a table controller with a Patch method:
public Task<User> PatchUser(string id, Delta<User> patch)
{
return UpdateAsync(id, patch);
}
I am locally hosting my mobile service and want to test how Patch would work. I am using Postman to do that, but I keep getting HTTP Error 400 with the following response:
{ "message": "The HTTP request did not include a valid entity body. Please ensure there is an entity body and an associated Content-Type header present in the request." }
These are the headers I am attaching to HTTP PATCH request:
I've read on this website that POST requests need to contain bodies like that: [ { "op": "replace", "path": "/email", "value": "[email protected]" } ]
If I provide a request body that you can see in the screenshot below, I still get the same response:
Here is class User that the table controller is based on:
public class User : EntityData
{
public string Gender { get; set; }
}
How should I properly send a Patch request via Postman?
You should use your second request but send the 'gender' property with a lowercase g instead of capital G. This is how you define this property in your model, JSON serializer/deserializer is case sensitive by default.