This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
1.0.0
This library provides methods to parse HTTP/1.1 requests string
version 2.0.0
license BSD3
native-modules False
elm-version 0.18.0 <= v < 0.19.0
Tag 2.0.0
Committed At 2017-10-09 18:12:16 UTC
elm-tools/parser 2.0.1 <= v < 3.0.0 2.0.1
elm-lang/core 5.1.1 <= v < 6.0.0 5.1.1
elm-community/json-extra 2.3.0 <= v < 3.0.0 2.7.0

Modules

README

Http.Parser

TODO:

  • [ ] RFC2616

This library provides methods to parse HTTP/1.1 requests string.

-- Example usage parsing a json request
let
    decoder =
        Decode.succeed ReqBody
            |: field "state" Decode.string
in
    request message |> andThen (json decoder)

Definition

type alias Request body = 
    { method : String
    , uri : String
    , headers : Dict String String
    , body : body
    }

Represent a parsed request with a parameterized body type

Parsing messages

request : String -> Result Error (Request String)

Parse a request message into a request representation

Parsing JSON

json : Decoder a -> Request String -> Result Error (Request a)

Decode the body of some previously parsed request expecting a json string and a Content-Type header with value application/json

Common helpers

andThen
    :  (Request String -> Result Error (Request a))
    -> Result Error (Request String)
    -> Result Error (Request a)

Chain a request parser to some body decoder

Parser errors

type Error
    = ParserError Error
    | DecoderError String

Represent an unexpected error while trying to parse or decode some part of the message