Skip to content

Commit

Permalink
document the middleware stack configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
stve committed Jun 13, 2012
1 parent 339b1f0 commit 2636319
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,29 @@ This functionality may be replicated by inserting custom Faraday middleware.

### Configuration

The Faraday middleware stack is now fully configurable. As a result, we've
removed `adapter` configuration. If you would like to change the default
adapter, you can do so in one of two ways:
The Faraday middleware stack is now fully configurable and is exposed as a
`Faraday::Builder` which can be manipulated in place:

Faraday.default_adapter = :some_other_adapter
Twitter.middleware.insert_after Twitter::Response::RaiseClientError, CustomMiddleware

Likewise, the middleware stack can be replaced in it's entirety:

Twitter.middleware = Faraday::Builder.new(&Proc.new { |builder|
# Specify a middleware stack here
})

or
As part of these configuration changes we've removed `adapter` configuration.
If you would like to change the adapter used, you can do so by setting Faraday's
`default_adapter`:

Twitter.middleware = Proc.new do |builder|
# Specify any other middleware you want to use here
Faraday.default_adapter = :some_other_adapter

The adapter can also be configured as part of the middleware stack:

Twitter.middleware = Faraday::Builder.new(&Proc.new { |builder|
# Specify a middleware stack here
builder.adapter :some_other_adapter
end
})

### Authentication

Expand Down

0 comments on commit 2636319

Please sign in to comment.