0

I am getting this error ERR_CONTENT_LENGTH_MISMATCH when i am calling my api. Client side Angular Backend Express (nodejs)

  • There are lots of answers for this at http://stackoverflow.com/questions/23521839/failed-to-load-resource-neterr-content-length-mismatch, https://github.com/nodejitsu/node-http-proxy/issues/623, https://github.com/swagger-api/swagger-node/issues/152 .... you might have to post the probably problematic code – lealceldeiro Mar 30 '17 at 17:15

1 Answers1

2

It seems that you are setting the Content-length header in Express but sending a body that doesn't match the declared size.

Avoid setting the Content-length in Express and use chunked encoding instead - that way you won't need to know the size up front and it will be impossible to declare the wrong size because you wouldn't declare any.

Errors like that can also sometimes be caused by the problems with proxy misconfiguration or permissions.

Of course it's impossible to tell for sure what you're doing wrong in a code that you didn't show.

rsp
  • 107,747
  • 29
  • 201
  • 177