An open API service indexing awesome lists of open source software.

https://github.com/seriousben/http-parser

HTTP Parser using parser combinators
https://github.com/seriousben/http-parser

golang http http-parser parser-combinators

Last synced: 3 months ago
JSON representation

HTTP Parser using parser combinators

Awesome Lists containing this project

README

          

# http-parser

HTTP response parser using [parser combinators](https://en.wikipedia.org/wiki/Parser_combinator).

## Parses [RFC2068](https://tools.ietf.org/html/rfc2068) compliant payload

```
HTTP/1.1 200 OK
Date: Mon, 23 May 2005 22:38:34 GMT
Content-Type: text/html; charset=UTF-8
Content-Encoding: UTF-8
Content-Length: 138
Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT
Server: Apache/1.3.3.7 (Unix) (Red-Hat/Linux)
ETag: "3f80f-1b6-3e1cb03b"
Accept-Ranges: bytes
Connection: close

An Example Page

Hello World, this is a very simple HTML document.

```

## Example

```go
b, _ := ioutil.ReadFile("./parser/testdata/simple-http.text")
parsedData, _ := Parse(b)
fmt.Printf("Status Code: %d", parsedData.StatusCode)
```