Rack::LinkHeaders
Easy Link header management for rack responses.
Installation
Add this line to your application's Gemfile:
gem 'rack-link_headers'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rack-link_headers
Usage
response.link "rel", "http://abc.de/"
response.link "rss", "http://test.host/feed.xml"
response.headers["Link"]
# => <http://abc.de/> rel="rel", <http://test.host/feed.xml> rel="rss"
Manual set Link header will be overridden. All links can be
accessed via links
:
response.link "rel", "http://abc.de/"
response.link "rss", "http://test.host/feed.xml"
response.links
# => [{:rel=>"rel", :url=>"http://abc.de/"}, {:rel=>"rss", :url=>"http://test.host/feed.xml"}]
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Add tests for your features.
- Add your features.
- Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
License
Copyright (c) 2013, Jan Graichen