Parse HTTP Request and Response from String in Node.JS
CoffeeScript Shell
Switch branches/tags
Nothing to show
Latest commit 48d0d53 May 11, 2015 @netmilk netmilk Bumped version to 0.0.5
Permalink
Failed to load latest commit information.
scripts
src
test fix: protocolVersion added to "expectedObject" mock May 7, 2015
.gitignore NPM package boilerplate Jul 23, 2013
.npmignore
.travis.yml
LICENSE
README.md
package.json Bumped version to 0.0.5 May 11, 2015

README.md

http-string-parser

Build Status Dependency Status devDependency Status

Parse HTTP messages (Request and Response) from raw string in Node.JS

##Parse HTTP Messages

var parser = require('http-string-parser');

request = parser.parseRequest(requestString);
response = parser.parseResponse(responseString);

console.log(request);
console.log(response);

See more about Request and Response data model.

API Reference

parseRequest(requestString)

parseRequestLine(requestLine)

parseResponse(responseString)

parseStatusLine(statusLine)

parseHeaders(headersLinesArray)


NOTE: Proof of concept, naive HTTP parsing, wheel re-inventation. In future it may be replaced with better parser from Node.JS core's C bindings of NGINX HTTP parser or PEG.js HTTP parser