DEV: Validate before and bumped_before options in TopicQuery (#23451)

This commit is contained in:
Ted Johansson 2023-09-07 12:38:03 +08:00 committed by GitHub
parent 93c32b9e07
commit ad58b6d604
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -19,6 +19,8 @@ class TopicQuery
array_or_string = lambda { |x| Array === x || String === x }
{
before: zero_up_to_max_int,
bumped_before: zero_up_to_max_int,
max_posts: zero_up_to_max_int,
min_posts: zero_up_to_max_int,
page: zero_up_to_max_int,

View File

@ -33,6 +33,12 @@ RSpec.describe ListController do
get "/latest?tags[1]=hello"
expect(response.status).to eq(400)
get "/latest?before[1]=haxx"
expect(response.status).to eq(400)
get "/latest?bumped_before[1]=haxx"
expect(response.status).to eq(400)
end
it "returns 200 for legit requests" do