Skip to content

Post params missing #156

Description

@damienbrz

I have the following

Rack::Attack.throttle('req/preview', limit: 3, period: 1.minute) do |req|
  puts "Rack::Attack> #{req.params.inspect}"
  req.params['item_id'] if "preview".in?(req.path) && req.post?
end

In my controller I have:

def preview
puts "Preview> #{params.inspect}"
...
end

When I run the following in my specs:

post items_preview_path(:item_id => @item.id, :preview_email => "test@test.com")

Here the print in the terminal:

Rack::Attack> {"preview_email"=>"test@test.com"}
Preview> {"preview_email"=>"test@test.com", "action"=>"preview", "controller"=>"items", "item_id"=>"1"}

I cannot figure out why I don't have access to params[:item_id] in the throttle block.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions