Angular 2.0,获得HPE_INVALID_CHUNK_SIZE [英] Angular 2.0, getting HPE_INVALID_CHUNK_SIZE

查看:347
本文介绍了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-EncodingContent-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

这篇关于Angular 2.0,获得HPE_INVALID_CHUNK_SIZE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆