Skip to content

Commit

Permalink
not_found requires two arguments (#761)
Browse files Browse the repository at this point in the history
  • Loading branch information
c960657 committed Sep 10, 2023
1 parent a47c436 commit 4060ccd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions spec/support/dummy_server/servlet.rb
Expand Up @@ -9,9 +9,9 @@ def self.sockets
@sockets ||= []
end

def not_found(_req, res)
def not_found(req, res)
res.status = 404
res.body = "Not Found"
res.body = "#{req.unparsed_uri} not found"
end

def self.handlers
Expand All @@ -27,7 +27,7 @@ def self.#{method}(path, &block)
def do_#{method.upcase}(req, res)
handler = self.class.handlers["#{method}:\#{req.path}"]
return instance_exec(req, res, &handler) if handler
not_found
not_found(req, res)
end
RUBY
end
Expand Down Expand Up @@ -68,7 +68,7 @@ def do_#{method.upcase}(req, res)
end

get "/params" do |req, res|
next not_found unless "foo=bar" == req.query_string
next not_found(req, res) unless "foo=bar" == req.query_string

res.status = 200
res.body = "Params!"
Expand All @@ -77,7 +77,7 @@ def do_#{method.upcase}(req, res)
get "/multiple-params" do |req, res|
params = CGI.parse req.query_string

next not_found unless {"foo" => ["bar"], "baz" => ["quux"]} == params
next not_found(req, res) unless {"foo" => ["bar"], "baz" => ["quux"]} == params

res.status = 200
res.body = "More Params!"
Expand Down

0 comments on commit 4060ccd

Please sign in to comment.