# ExLinkHeader

Parse HTTP link headers in Elixir.

# Usage

ExLinkHeader.parse!("<>; rel=\"next\", <>; rel=\"last\", <>; rel=\"first\"")
#=> %{"first" => %{page: "1", per_page: "100", rel: "first", url: ""}, "last" => %{page: "3", per_page: "100", rel: "last", url: ""}, "next" => %{page: "2", per_page: "100", rel: "next", url: ""} }

#=> ** (ExLinkHeader.ParseError) Parse error: no valid links to parse

## Note a change in v0.0.4

Links with no `page` or `per_page` param previously returned `nil` by default for both these params, even if they did not exist - this is now no longer the case, `page` and `per_page` are now treated like any other query params. To return `nil` for these values you can supply defaults for any param when calling `parse` to ensure default values are returned, for example:

ExLinkHeader.parse!("<>; rel=\"next\", ", %{page: nil})
#=> %{"next" => %{
        url: "",
        page: nil,
        per_page: "100",
        rel: "next"

## Code Status

[![Build Status](](

## Installation

The package can be installed as:

  1. Add ex_link_header to your list of dependencies in `mix.exs`:

        def deps do
          [{:ex_link_header, "~> 0.0.4"}]

  2. Ensure ex_link_header is started before your application:

        def application do
          [applications: [:ex_link_header]]

## License

Released under the Apache 2 License.

See [LICENSE](LICENSE) for more information.