Class: FaradayMiddleware::NullResponseBody
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- FaradayMiddleware::NullResponseBody
- Defined in:
- lib/faraday/null_response_body.rb
Overview
This middleware handles any responses where the body is ‘null’ which is the case when asking teamcity for an empty collection. When this is encountered we set the response to an empty json object
Instance Method Summary collapse
-
#call(env) ⇒ Object
Faraday Middleware.
Instance Method Details
#call(env) ⇒ Object
Note:
-
should only be called by Faraday
Faraday Middleware
9 10 11 12 13 14 15 |
# File 'lib/faraday/null_response_body.rb', line 9 def call(env) @app.call(env).on_complete do |response| if response[:body] == "null" response[:body] = {} end end end |