Skip to content

Commit

Permalink
Merge pull request #3452 from alphagov/handle-unfiltered-parameters
Browse files Browse the repository at this point in the history
updated code to handle unfiltered parameters
  • Loading branch information
KludgeKML authored Sep 24, 2024
2 parents a7fa98a + 9e913bd commit 905720d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/finders_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def show
end
end
end
rescue ActionController::UnknownFormat
rescue ActionController::UnknownFormat, ActionController::UnfilteredParameters
render plain: "Not acceptable", status: :not_acceptable
rescue UnsupportedContentItem
render plain: "Not found", status: :not_found
Expand Down
5 changes: 5 additions & 0 deletions spec/controllers/finders_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,11 @@
it "redirects to research-and-statistics finder for statistics" do
expect(get(:show, params: @default_params.merge(publication_type: "statistics"))).to redirect_to("/search/research-and-statistics")
end

it "returns a 406 if there are unfiltered parameters" do
get(:show, params: @default_params.merge(publication_type: "foi-releases", organisations: { foo: "bar" }))
expect(response.status).to eq(406)
end
end

describe "when there are legacy parameters present" do
Expand Down

0 comments on commit 905720d

Please sign in to comment.