I get some json data sent to my asp.net webapi, but the post parameter always approaches zero - the data is not being serialized correctly. The method looks something like this:
public HttpResponseMessage Post(string id, RegistrationData registerData)
The problem seems to be that the client (which I don't control) always sends the content type as x-www-form-urlencoded
, although the content is actually json. This causes mvc to try to deserialize it as form data, which fails.
Is there a way to make webapi always deserialize as json and ignore the content header?
source share