Nathan Fiedler
2007-Jul-27 19:00 UTC
How to retrieve response headers in integration tests?
With the code below, the output is "Date is: []". Why? If I start the server and `curl` the URL, I get headers that include Last-Modified, yet I cannot retreive them from within the integration tests. What am I doing wrong? require File.dirname(__FILE__) + ''/../test_helper'' class CacheTest < ActionController::IntegrationTest def test_caching get "/repos/#{@repos}/revisions" assert_response 200 date = headers[''Last-Modified''] puts ''Date is: '' + date.inspect # ... end end Thanks n --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Nathan Fiedler
2007-Jul-28 21:16 UTC
Re: How to retrieve response headers in integration tests?
Okay, so the AWDR book was mistaken (p212) in that the ''headers'' accessor does not give you useful information from the last response in the integration test. Instead, using ''response.headers'' gave me what I was expecting. n --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---