Class: Her::Middleware::AcceptJSON
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- Her::Middleware::AcceptJSON
- Defined in:
- lib/her/middleware/accept_json.rb
Overview
This middleware adds a “Accept: application/json” HTTP header
Instance Method Summary collapse
Instance Method Details
#add_header(headers) ⇒ Object
5 6 7 |
# File 'lib/her/middleware/accept_json.rb', line 5 def add_header(headers) headers.merge! "Accept" => "application/json" end |
#call(env) ⇒ Object
9 10 11 12 |
# File 'lib/her/middleware/accept_json.rb', line 9 def call(env) add_header(env[:request_headers]) @app.call(env) end |