link-header

Version, currently 1.0.13 versions

github.com/spider-gazelle/link-header

Crystal Lang HTTP Link Header Parser

1 stars
0 dependents
License: MIT

Nothing has been indexed for 1.0.1 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.

Installation

# Add this to your shard.yml
dependencies:
  link-header:
    github: spider-gazelle/link-header
    version: ~> 1.0.1

Then run:

shards install

shard.yml

No shard.yml has been indexed for 1.0.1. You can read it on the repository.

Dependencies

Unknown: the shard.yml for this version has not been read yet.

README

This README is the one indexed from the repository at its latest ref, not from the tag for this version.

Crystal Lang HTTP Link Header Parser

Build Status

Parses link headers

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      link-header:
        github: spider-gazelle/link-header
  2. Run shards install

Usage


require "http/client"
require "link-header"

# Parse the links out of the response
response = HTTP::Client.get "http://www.example.com"
links = LinkHeader.new(response)

# equivalent to the above
links = LinkHeader.new(response.headers)

# Get the first link matching a `rel`
links["next"] # => "https://next.link/"  or raise KeyError
links["next"]? # => "https://next.link/" or nil

# Get all the links matching a `rel`
links.get("preconnect") # => ["https://link.1/", "https://link.2/"]
links.get("missing") # => []