require 'rack/test'

module Airborne
  module RackTestRequester
    def make_request(method, url, options = {})
      headers = options[:headers] || {}
      base_headers = Airborne.configuration.headers || {}
      headers = base_headers.merge(headers)
      browser = Rack::Test::Session.new(Rack::MockSession.new(Airborne.configuration.rack_app))
      browser.send(method, url, options[:body] || {}, headers)
      Rack::MockResponse.class_eval do
        alias_method :code, :status
      end
      browser.last_response
    end
  end
end

require 'rack/test'

module Airborne
  module RackTestRequester
    def make_request(method, url, options = {})
      headers = options[:headers] || {}
      base_headers = Airborne.configuration.headers || {}
      headers = base_headers.merge(headers)
      browser = Rack::Test::Session.new(Rack::MockSession.new(Airborne.configuration.rack_app))
      headers.each { |name, value| browser.header(name, value) }
      browser.send(method, url, options[:body] || {}, headers)
      Rack::MockResponse.class_eval do
        alias_method :code, :status
      end
      browser.last_response
    end
  end
end

Fix headers not passing during rack-test request
Fix headers not passing during rack-test request

When making a rack-test request (Rack app is mounted during airborne
config), the parameters were not passed into the request. For example:

```
get '/endpoint', { 'Content-Type' => 'text/plain' }
```

Would result in the /endpoint being hit without the above Content-Type
header. This commit resolves the issue by using the `header` method on
rack-test's `Session` class.

http://www.rubydoc.info/gems/rack-test/0.6.3/Rack/Test/Session#header-instance_method
