My request body is:
{
"value": "b\\a",
}
When I read it at middleware level with body = await reader.ReadToEndAsync();
I am getting the same request body string.
BUT when I use the binded value in controller it has only one backslash.
[ProducesResponseType(201)]
[HttpPost("lol")]
public async Task<ActionResult> Create([FromBody] TokenDTO token)
{
var a = token.value;
if (a == "b\\\\a")
{
Console.WriteLine("EQUAL:" + a);
}
else
{
Console.WriteLine("NOT EQUAL:" + a);
}
return Created(token);
}
Here I am getting this response: NOT EQUAL:b\a
Is it some kind of bug? Or I should decode request body in some way?
I checked whether middleware does not corrupt it by removing it and the issue still remains.