I am trying to send a large string to c# controller. controller signature looks like this:
public async Task<IHttpActionResult> Post([FromBody] string longString)
I am getting longString as null. I am doing the same in Postman and see that if turn off the default Content-Length header which says: "calculated when request is sent" and add the same header with a value that equal the length of the string + 8 the back end gets correct value as it does when default Content-Length header is on. My POST request from Angular has everything the same except the value of Content-Length header. It is equal the length of the string + 6. So, I am trying to change Content-Length header value to the one that works in Postman like this:
headers = new HttpHeaders().set('Content-Type', 'application/json;');
headers.set('Content-Length', '140317');
But Network shows that the above change is not taking a place.
Any idea how get it work?
Thanks