Using the rest 4 template. I have a POST method defined, with an object as a parameter. REST 4 does a great job of automatically mapping both xml and json posts to the method. I tested this using an HttpClient test application to build
and post xml content and then json content. All data gets correctly mapped to the corresponding properties in my entity.
I want to also support a standard form post to the method but am having problems!
I'd like the same method already accepting and converting both xml and json to also work correctly for a form post. I figured it would "just work" but no.
I am testing this by creating an HttpUrlEncoded form in the test client, adding form name/value pairs that match what the method is expecting, and trying to post it.
However I get a 400 Bad Request. Here's some example code that is returning a 400 bad request:
Really straightforward but fails. Ideas why?
var client = new HttpClient();
HttpUrlEncodedForm form = new HttpUrlEncodedForm();
View Complete Post