0

I am using post method (MCV4 - Web API - apicontroller), like this:

public HttpResponseMessage Post([FromBody]string value)
{
     return Request.CreateResponse(HttpStatusCode.OK, value);
}

I am using google chrome - advanced rest client add-in.

  1. For some reason the value is always null (I passed it on raw - payload part of advanced rest client).

  2. I need to change always the content type to json/application (manually in google chrome advanced rest client) - Can I force some defaults (on webapiconfig.cs or elsewhere)?

Thanks :)

1 Answer 1

1

Hopefully you've already found a solution, but I've been fighting with this the last half hour and came across your question (without a solution), and since I finally got it to work, I figured I'd post my solution:

Leave the Content-Type as:

application/x-www-form-urlencoded

In the Raw Payload, enter the string you want to pass in as:

=mystring

Note the equal sign before your string with nothing before it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.