This project is archived and is in readonly mode.
[Patch] ActiveResource::HttpMock overwrites Accept/Content-Type header
Reported by Elomar França | June 22nd, 2010 @ 11:56 PM | in 3.0.2
ActiveResource::HttpMock always overwrite the Accept/Content-Header parameter of the recorded response to "application/xml", making it impossible to mock two different responses to the same method/url but with different mime types.
ActiveResource::HttpMock.respond_to do |mock|
mock.get "/people/1", {"Accept" => "application/xml"}, "XML"
mock.get "/people/1", {"Accept" => "application/json"}, "Json"
end
@http.get("/people/1", {"Accept" => "application/json"}).body # > XML
This patch fixes that by 1) not overwriting the format header and 2) ignoring it on the response match on it's not set on the mock and add some basic tests to HttpMock, but I think the code can be improved.
Comments and changes to this ticket
-
José Valim June 24th, 2010 @ 01:27 AM
- Milestone cleared.
- Assigned user set to José Valim
-
Repository June 24th, 2010 @ 12:28 PM
- State changed from new to resolved
(from [176c386409fd57bc03b9ebf1570a8955e21e0800]) Fix bug where ActiveResource::HttpMock would overwrite Accept/Content-Type header to application/xml [#4939 state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/176c386409fd57bc03b9ebf1570a89... -
Jeremy Kemper October 15th, 2010 @ 11:01 PM
- Milestone set to 3.0.2
- Importance changed from to Low
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Tags
Referenced by
- 4939 [Patch] ActiveResource::HttpMock overwrites Accept/Content-Type header (from [176c386409fd57bc03b9ebf1570a8955e21e0800]) Fix bug...