Class: Faraday::Response::VerifyStatus
- Inherits:
-
Response::Middleware
- Object
- Response::Middleware
- Faraday::Response::VerifyStatus
- Defined in:
- lib/faraday/response/verify_status.rb
Instance Method Summary collapse
Instance Method Details
#on_complete(env) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/faraday/response/verify_status.rb', line 4 def on_complete(env) status = env[:status].to_i case env[:method] when :get raise LetsFreckle::FetchError, "Fetch failed, HTTP error: #{status}" unless status == 200 when :post raise LetsFreckle::CreateError, "Create failed, HTTP error: #{status}" unless status == 201 end end |