#31 open
Nicolas Blanco

Making POST request after redirect :back fails

Reported by Nicolas Blanco | November 11th, 2008 @ 05:08 PM | in 0.5

When I try to click a link with a POST method after a redirect :back it fails with an exception "Only post requests are allowed. (ActionController::MethodNotAllowed)".

Reproduce it :

routes.rb :


map.resource :session, :member => { :blabla => :post }

In the sessions/new view :


<%= link_to "blabla", blabla_session_path(:id => 1), :method => :post %>

In the SessionsController :


def blabla
  redirect :back
end

The Webrat test :


visits "/session/new"
clicks_link "blabla"
clicks_link "blabla"

The first click succeeds, the second click fails with an exception "Only post requests are allowed. (ActionController::MethodNotAllowed)".

Thanks, Nicolas.

Comments and changes to this ticket

  • gaffo

    gaffo January 6th, 2009 @ 09:11 PM

    • State changed from “new” to “open”

    I verified that this is a bug and I wanted to try a new experiment.

    I created a toy rails app at git://github.com/gaffo/webrat_rails_bugs.git

    Master is supposed to be a baselined version of rails with webrat, so it's easy to start from there.

    There's also a branch called lh_31 which replicates this bug.

    The theory being that it'll be much easier to identify bugs if you can swap right to a test app to see it. Let me know if this makes sense or is interesting. I find it a pain in the a** to recreate bugs continually from posts so I thought it was worthwhile.

  • Bryan Helmkamp

    Bryan Helmkamp February 9th, 2009 @ 12:10 AM

    • Milestone set to 0.5

    Hey Mike --

    Would it be possible for you to take the branch that demonstrates the bug in that repo and convert it to a branch with changes to our shiny new integration spec suite?

    That would make it a bit easier for me to dive in and get this resolved.

    Thanks,

    -Bryan

  • Cyril Mougel

    Cyril Mougel April 28th, 2009 @ 12:38 PM

    • Tag set to http_referer, redirect

    I am the same issue. It's pity that not already fix.

  • Daisuke Muraoka

    Daisuke Muraoka November 18th, 2009 @ 09:57 PM

    Most web browsers request after redirected that does not change the referer. But Webrat::Session#request_page always change referer.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Ruby Acceptance Testing for Web applications.

Shared Ticket Bins

People watching this ticket

Attachments

Pages