HTTP标头parsing器

在node.js中,当源代码是缓冲区/string时,有哪些轻量级的方法可以parsingHTTP头文件? 像使用express.js或节点的内部http模块,但不创build实际的networking连接。

github / opensource,目前开发者的select偏好“主旨”types的解决scheme,谢谢

您可以使用节点的http模块内部使用的内置HTTPParser。

你想从请求中检索标题而不连接? 我不知道你想做什么,但是你看看节点的核心模块“http”?

例:

var require('http'); http.request({ host : 'localhost', port : 8080, method : 'GET', path : '/endpoint' }, function(res) { res.on('end', function() { console.log('My headers: %O', res.headers); res.end(); } });