Rack middleware to use with HttpMonkey and support magic cookies on your requests.
TOC:
Add this line to your application's Gemfile:
gem 'http_monkey-cookie'
And then execute:
$ bundle
Or install it yourself as:
$ gem install http_monkey-cookie
require "http_monkey"
require "http_monkey/cookie"
HttpMonkey.configure do
# Default HTTP Headers (to all requests)
middlewares.use HttpMonkey::M::Cookie
end
response = HttpMonkey.at("http://domain.com").get
# Returns Set-Cookie: token=magic;Version=1;Comment=;Domain=.domain.com;Path=/;Max-Age=999999999;httpOnly
HttpMonkey.at("http://domain.com/service").get
# Uses Cookie: token=magic etc.
HttpMonkey.at("http://example.com").get
# Don't send cookies
This version is experimental and can explode in any moment.
Some resources to build a new cookie project: