Martin Gamsjaeger
2007-Feb-14 23:55 UTC
GET parameters working in POST requests using Prototype 1.5.0
Hiall,
I just noticed that in code I wrote quite a while ago I did the
following, which actually worked fine:
new Ajax.Request(''/foo/bar?param1=foo¶m2=bar", { ... })
The thing is, I didn''t specify method: get so Prototype issued the
default POST request. My rails controller had no problem accessing the
parameters via the params hash. Now I''m thinking, is there any reason
that rails/prototype didn''t complain that I was using GET parameters
in my POST request? Should it actually complain or not? Is there any
reasonable situation where one would mix POST and GET parameters? I''m
a little confused, as my general opinion would be to at least ignore
those parameters or even better, give a warning somehow? Or does it
simply not matter to mix these and it is therefore ok?
thx in advance
Martin Gamsjaeger
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Jon Garvin
2007-Feb-15 00:11 UTC
Re: GET parameters working in POST requests using Prototype 1.5.0
In your controller, you should have something like the following to
limit specific actions to only work as posts.
verify :method => :post, :only => [ :destroy, :create, :update ],
:redirect_to => { :action => ''show'' }
Martin Gamsjaeger wrote:> Hiall,
>
> I just noticed that in code I wrote quite a while ago I did the
> following, which actually worked fine:
>
> new Ajax.Request(''/foo/bar?param1=foo¶m2=bar", { ...
})
>
> The thing is, I didn''t specify method: get so Prototype issued the
> default POST request. My rails controller had no problem accessing the
> parameters via the params hash. Now I''m thinking, is there any
reason
> that rails/prototype didn''t complain that I was using GET
parameters
> in my POST request? Should it actually complain or not? Is there any
> reasonable situation where one would mix POST and GET parameters?
I''m
> a little confused, as my general opinion would be to at least ignore
> those parameters or even better, give a warning somehow? Or does it
> simply not matter to mix these and it is therefore ok?
>
> thx in advance
> Martin Gamsjaeger
>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Jodi Showers
2007-Feb-15 01:18 UTC
Re: GET parameters working in POST requests using Prototype 1.5.0
On 14-Feb-07, at 6:55 PM, Martin Gamsjaeger wrote:> > Hiall, > > I just noticed that in code I wrote quite a while ago I did the > following, which actually worked fine: > > new Ajax.Request(''/foo/bar?param1=foo¶m2=bar", { ... }) > > The thing is, I didn''t specify method: get so Prototype issued the > default POST request. My rails controller had no problem accessing the > parameters via the params hash. Now I''m thinking, is there any reason > that rails/prototype didn''t complain that I was using GET parameters > in my POST request? Should it actually complain or not? Is there any > reasonable situation where one would mix POST and GET parameters? I''m > a little confused, as my general opinion would be to at least ignore > those parameters or even better, give a warning somehow? Or does it > simply not matter to mix these and it is therefore ok? > > thx in advance > Martin Gamsjaegerin my previous incarnation as a java-dude, I''d often mix GET params inside a POST request - generally for the purposes of authentication. Prototype will just see it as part of the URL, and Rails is likely parsing it wholesale into params. Jodi --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---