Changeset 1042

Show
Ignore:
Timestamp:
11/24/07 14:13:19 (1 year ago)
Author:
e.@brainspl.at
Message:

do not allow query string params to override url params. so /foo/bar/42?id=24 ... params[:id].should == 42 not 24, closes #299

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/merb/request.rb

    r966 r1042  
    9898    def params 
    9999      @params ||= begin 
    100         h = route_params.to_mash.merge(body_and_query_params)         
     100        h = body_and_query_params.to_mash.merge(route_params)       
    101101        h.merge!(multipart_params) if self.class.parse_multipart_params && multipart_params 
    102102        h.merge!(json_params) if self.class.parse_json_params && json_params 
  • trunk/spec/merb/dispatch_spec.rb

    r1033 r1042  
    2626    end 
    2727  end 
     28   
     29  it "should not overwrite url params with query string params" do 
     30    controller, action = request(:get, '/foo/bar/42?id=24') 
     31    controller.class.should == Foo 
     32    action.should == "bar" 
     33    controller.params[:id].should == '42' 
     34  end   
    2835   
    2936  it "should not allow private and protected methods to be called" do