forked from bblimke/webmock
-
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.
Ensure multiple values for the same header can be recorded and played…
… back. This already worked for most adapters, but had an issue for the HTTP client adapter. Note that I had to change the line breaks in the webmock server response to \r\n (which matches the HTTP spec, I believe) in order to get curb and patron to parse the headers correctly.
- Loading branch information
1 parent
7c21556
commit 5534968
Showing
5 changed files
with
52 additions
and
6 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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,21 @@ | |||
shared_context "complex cross-concern behaviors" do |*adapter_info| | |||
it 'allows a response with multiple values for the same header to be recorded and played back exactly as-is' do | |||
WebMock.allow_net_connect! | |||
|
|||
recorded_response = nil | |||
WebMock.after_request { |_,r| recorded_response = r } | |||
real_response = http_request(:get, webmock_server_url) | |||
|
|||
stub_request(:get, webmock_server_url).to_return( | |||
:status => recorded_response.status, | |||
:body => recorded_response.body, | |||
:headers => recorded_response.headers | |||
) | |||
|
|||
played_back_response = http_request(:get, webmock_server_url) | |||
|
|||
played_back_response.headers.keys.should include('Set-Cookie') | |||
played_back_response.should == real_response | |||
end | |||
end | |||
|
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