Class: LoogiHttp::Middleware::AcceptJson
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- LoogiHttp::Middleware::AcceptJson
- Defined in:
- lib/loogi_http/middleware/request/accept_json.rb
Overview
Faraday middleware to set ‘Accept` header to `application/json`.
Instance Method Summary collapse
-
#call(env) ⇒ Faraday::Response
Set the ‘Accept` header to `application/json`.
Instance Method Details
#call(env) ⇒ Faraday::Response
Set the ‘Accept` header to `application/json`. Overwrites existing header.
12 13 14 15 16 |
# File 'lib/loogi_http/middleware/request/accept_json.rb', line 12 def call(env) headers = env[:request_headers] headers['Accept'] = 'application/json' @app.call env end |