Angular 2.0,获得HPE_INVALID_CHUNK_SIZE
我目前在客户端使用Angular 2.0,在服务器端使用Spring Boot. 当前,我面临一个问题,即客户端向服务器发送发布请求,而服务器在5分钟后以json的形式发送响应,并发送一个巨大的json.在角度为2.0的客户端上,我得到了HPE_INVALID_CHUNK_SIZE,并且它已关闭. 我试过在邮递员中使用相同的http post请求,并且工作正常. 有人可以帮我解决这个问题吗?
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?
如果我没有发送正确的Transfer-Encoding
或Content-Length
http标头,我也会遇到类似的麻烦.对我来说,解决方案是发送Content-Length
或忽略它,然后发送Transfer-Encoding: chunked
.
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.
通常来讲,当我第一次使用JavaScript时遇到HPE_INVALID_CHUNK_SIZE
错误时,我所做的就是检查要发送到服务器的标头.
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.
我建议检查POST人员发送的标头,并将其与您的角度应用程序发送的标头进行比较.
I would recommend to examine headers sent by POST man and compare them to those sent by your angular app.
https://developer.mozilla .org/zh-CN/docs/Web/HTTP/Headers/Transfer-Encoding#Directives