0

When searchItem parameter has special characters like "+", the special character is omitted out upon hitting the endpoint. I tried URL encoding the parameter but that causes a 404 error too. Please help

    [HttpGet]
    [Route("search/{searchItem}")]
    public HttpResponseMessage Search(string searchItem)
    {

        return Request.CreateResponse(HttpStatusCode.OK);
    }

1 Answers1

0

The very first idea is to create binding model and get the value from body.

[HttpGet]
[Route("search")]
public HttpResponseMessage Search([FromBody] SearchItemDto model)
{

    return Request.CreateResponse(HttpStatusCode.OK);
}
klucyszy
  • 152
  • 6