I have simple REST server GET method:
public class PersonController : ApiController
{
// GET: api/Person
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
...
}
It works fine with cpp rest client:
http_response httpResponse = httpClient.request(methods::GET).get();
if (httpResponse.status_code() == status_codes::OK)
{
wstring output = httpResponse.extract_utf16string().get();
wcout << output << endl;
}
I decided to pass some parameters while do GET
and have done changes in:
client:
http_response httpResponse = httpClient.request(methods::GET,L"HELLO").get();
server:
public IEnumerable<string> Get([FromBody]string value)
[FromBody]string value
I have coppyed from POST
method and was expecting it will work.
Unfortunately client call has no response from server side now. Can I use GET
with parameters in general? What I do wrong?
UPD:
I have removed [FromBody]
, but still have response 400 from client side
public IEnumerable<string> Get(string value)