Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

[PATCH] ActionController::Integration::Session#get does not set HTTP_REFERER

#3111

Rails version: 2.3.3

In an integration test, where sequential calls to get/put/post should emulate a users behaviuor in a browser, I expect that sequntial calls would set HTTP_REFERER header to the value of the last request performed.

Currently I have to do this manually, by

get orders_path, nil, { "HTTP_REFERER" => @request.url }

for every call to get/put/post that is not the first one.

Jarl

Reported by Jarl Friis · August 28th, 2009 @ 09:09 AM

State: stale
Milestone: none
Assigned to: nobody
Importance: none

Activity

  1. CancelProfileIsBroken
    CancelProfileIsBroken
    • Tag changed from headers, integration_test, session to bugmash, headers, integration_test, session

    September 25th, 2009 @ 12:39 PM

  2. Elomar França
    Elomar França
    • Tag changed from bugmash, headers, integration_test, session to bugmash, headers, integration_test, patch, session
    • Title changed from ActionController::Integration::Session#get does not set HTTP_REFERER to [PATCH] ActionController::Integration::Session#get does not set HTTP_REFERER
    1. IMO, this is the right way to simulate the user behavior.

    I've attached a tiny little patch.

    September 26th, 2009 @ 01:47 PM

  3. Elomar França
    Elomar França

    Forgot to mention, patch applies only on 2-3-stable. I could not get it working on master yet.

    September 26th, 2009 @ 01:58 PM

  4. David Trasbo
    David Trasbo

    +1

    I definitely also think Rails should try to simulate browser behaviour in integration tests.

    verified

    The patch applies cleanly to 2-3-stable and the test is passing.

    September 26th, 2009 @ 05:54 PM

  5. sr.iniv.t
    sr.iniv.t

    +1 verified. +1 for the idea too.

    Patch applies cleanly on 2-3-stable and all tests pass.

    September 27th, 2009 @ 07:41 PM

  6. Elomar França
    Elomar França

    I've attached a patch that applies on master.

    September 27th, 2009 @ 10:06 PM

  7. Gaius Centus Novus
    Gaius Centus Novus

    +1 & verified for the 2-3-stable patch

    September 27th, 2009 @ 11:18 PM

  8. Jarl Friis
    Jarl Friis

    Even though the tittle only mentions the get method, the problem should also be fixed on put and post methods, I haven't investigated the patch to see if it also fixes the problem for those methods. Elomar, can you tell?

    Jarl

    September 28th, 2009 @ 10:37 AM

  9. Elomar França
    Elomar França

    Jarl,

    Yes, it fixes this problem for any method.

    September 28th, 2009 @ 11:45 AM

  10. Rizwan Reza
    Rizwan Reza
    • Tag changed from bugmash, headers, integration_test, patch, session to headers, integration_test, patch, session

    February 12th, 2010 @ 12:46 PM

  11. Santiago Pastorino
    Santiago Pastorino
    • State changed from new to open
    • Importance changed from to

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

    February 2nd, 2011 @ 04:44 PM

  12. Santiago Pastorino
    Santiago Pastorino
    • State changed from open to stale

    February 2nd, 2011 @ 04:44 PM