Nodejs 请求:HPE_INVALID_HEADER_TOKEN [英] Nodejs request: HPE_INVALID_HEADER_TOKEN
本文介绍了Nodejs 请求:HPE_INVALID_HEADER_TOKEN的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用 request
模块在某个页面上收到 HPE_INVALID_HEADER_TOKEN
.根据我在 Google 上的发现,这是由不正确/格式错误的服务器响应引起的,但后者不受我的控制.我可以将请求配置为忽略无效标头还是只给我整个原始响应以供处理?
I receive HPE_INVALID_HEADER_TOKEN
on a certain page using request
module. From what I've found on Google, this is caused by an incorrect / malformed server response, however the latter is not under my control. Can I configure request to ignore invalid headers or just give me the whole raw response for processing?
推荐答案
解决方案是这个库:https://www.npmjs.com/package/http-parser-js
所以要解决您的问题:
npm install http-parser-js
npm install http-parser-js
在 require('request') 之前添加这段代码
Add this code before require('request')
process.binding('http_parser').HTTPParser = require('http-parser-js').HTTPParser;
这篇关于Nodejs 请求:HPE_INVALID_HEADER_TOKEN的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文