Darshil Gada
Darshil Gada

Reputation: 95

Angular 2.0, getting HPE_INVALID_CHUNK_SIZE

I am currently using Angular 2.0 for client and Spring Boot for server side. Currently, I am facing an issue where client sends a post request to server and server sends a response as a json after 5 minutes and its a huge json. On the client side that is angular 2.0 , I am getting HPE_INVALID_CHUNK_SIZE and it gets closed. I have tried using the same http post request in postman and its works fine. Can you anyone please help me with this issue?

Upvotes: 2

Views: 2753

Answers (1)

svobol13
svobol13

Reputation: 1960

I got into similar troubles if I did not send proper Transfer-Encoding or Content-Length http headers. Solution for me was to either send Content-Length or ommit it and send Transfer-Encoding: chunked instead.

Generally speaking whenever I got HPE_INVALID_CHUNK_SIZE error while doing with JavaScript first I do is checking headers I am sending to server.

I would recommend to examine headers sent by POST man and compare them to those sent by your angular app.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Transfer-Encoding#Directives

Upvotes: 2

Related Questions