Search code examples
c#apiurlpostmanendpoint

Why does postman substitute characters in my get request string?


I am making a get request through postman and when the request reaches my controller, the characters like "+" are converted to empty spaces " ". The api is written in c#.

My controller code is:

[RoutePrefix("")]
public partial class _DesifrarCusController : CaramlController, I_DesifrarCusController 
{
    [HttpGet]
    [Route("descifrarCus")]
    public IHttpActionResult GetDescifrarCusResponse( [FromUri] string cus = null ) {
        return Ok (ExecGetDescifrarCusResponse(cus));
        //return Ok();
    }
}

Does anyone have any idea what postman is doing with the request string?

I have tried to send the string between quotes and with ascii characters and still the problem persists.

I add capture of the postman headers


Solution

  • You need to encode the parameter on Postman. First add the parameter under Params tab

    enter image description here

    then select the value and right click the value chose EncodeURIComponent enter image description here

    then you will get encoded parameter

    enter image description here

    Reference: https://learning.postman.com/docs/sending-requests/requests/