forked from lostisland/faraday
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve how params, headers & options are handled in the request phase
Old behavior: # init connection with some defaults: conn = Faraday.new :params => {...}, :request => {...} conn.get('/') do |request| request.params = {...} # params got merged with defaults request.options = {...} # options got deep-merged with defaults end New behavior: conn.get('/', {...}) do |request| request.params.update(...) # merge with existing params request.params = {...} # replace all existing params request.options[:proxy][:user] = "..." # add extra request options: request.options = {...} # replace all existing options end Pros of the new behavior are consistency, ability to completely override parameters per-request. Cons are breaking backwards-compatibility.
- Loading branch information
Showing
4 changed files
with
157 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters