Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Change Response::RaiseError to be processed last #6

wants to merge 1 commit into from

2 participants


Since response middleware are processed in the reverse order of being added, this makes Response::RaiseError be last, so the Exceptions raised have nicer, parsed bodies.


This could create a problem though since not all bodies are formatted in a way that would allow them to be parsed.


I’m not sure how this is a problem - the response handlers will only attempt to parse responses with the appropriate content type, so if a response body doesn’t match JSON, XML or HTML it will not be parsed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 1, 2011
  1. @vandrijevik
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/faraday_stack.rb
2  lib/faraday_stack.rb
@@ -40,12 +40,12 @@ def = nil, options = {})
builder.request :url_encoded
builder.request :json
yield builder if block_given?
+ builder.response :raise_error
builder.use ResponseXML, :content_type => /[+\/]xml$/
builder.use ResponseHTML, :content_type => 'text/html'
builder.use ResponseJSON, :content_type => /(application|text)\/json/
builder.use ResponseJSON::MimeTypeFix, :content_type => /text\/(plain|javascript)/
builder.use FollowRedirects
- builder.response :raise_error
builder.adapter Faraday.default_adapter
Something went wrong with that request. Please try again.