# http-string-parser

> Parse HTTP Request and Response from String

Latest version **0.0.6** (published 2017-06-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install http-string-parser
pnpm add http-string-parser
yarn add http-string-parser
bun add http-string-parser
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2017-06-05 |
| First published | 2013-07-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/http-string-parser) |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 26 |
| Author | Adam Kliment |
| Maintainers | almad, apiary-sre, honzajavorek, kubakubula, netmilk, tu1ly |
| Keywords | http, message, request, response, parser, string, raw, bare |

## Links

- npm: https://www.npmjs.com/package/http-string-parser
- Repository: https://github.com/apiaryio/http-string-parser
- Homepage: https://github.com/apiaryio/http-string-parser#readme
- Issues: https://github.com/apiaryio/http-string-parser/issues
- npm.io page: https://npm.io/package/http-string-parser

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.0.6 (latest) — 2017-06-05
- 0.0.5 — 2015-05-11
- 0.0.4 — 2013-07-25
- 0.0.3 — 2013-07-25
- 0.0.1 — 2013-07-23
- 0.0.0 — 2013-07-23

## README

# http-string-parser

[![NPM Version](https://img.shields.io/npm/v/http-string-parser.svg)](https://www.npmjs.com/package/http-string-parser)
[![Build Status](https://travis-ci.org/apiaryio/http-string-parser.png)](https://travis-ci.org/apiaryio/http-string-parser)
[![Dependency Status](https://david-dm.org/apiaryio/http-string-parser.png)](https://david-dm.org/apiaryio/http-string-parser)
[![devDependency Status](https://david-dm.org/apiaryio/http-string-parser/dev-status.png)](https://david-dm.org/apiaryio/http-string-parser#info=devDependencies)

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

## Parse HTTP Messages
```javascript
var parser = require('http-string-parser');

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

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

See more about [Request][request] and [Response][response] data model.

[request]: https://www.relishapp.com/apiary/gavel/docs/data-model#http-request
[response]: https://www.relishapp.com/apiary/gavel/docs/data-model#http-response

## 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](https://github.com/joyent/http-parser) or [PEG.js HTTP parser](https://npmjs.org/package/http-pegjs)

---
_Source: https://npm.io/package/http-string-parser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
