link-header v1.0.2
Crystal Lang HTTP Link Header Parser
Parses link headers
Installation
-
Add the dependency to your
shard.yml
:dependencies: link-header: github: spider-gazelle/link-header
-
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") # => []
Repository
link-header
Owner
Statistic
- 1
- 0
- 0
- 1
- 0
- over 3 years ago
- September 30, 2020
License
MIT License
Links
Synced at
Sat, 21 Dec 2024 08:07:52 GMT
Languages