split up the nil? and empty? cases, because they are different

situations
pull/21/head
Adam Townsend 2023-10-12 14:27:31 -07:00
parent 1e61a76ded
commit cabb4daded
1 changed files with 7 additions and 2 deletions

9
app.rb
View File

@ -50,9 +50,14 @@ class App < Roda
end end
url = r.params['url'] url = r.params['url']
if url.nil? or url.empty? if url.nil?
response.status = 400 response.status = 400
return {message: "Please enter a valid URL"} return {message: "missing url parameter"}.to_json
end
if url.empty?
response.status = 400
return {message: "invalid url parameter"}.to_json
end end
if links.filter(:url => url).first.nil? if links.filter(:url => url).first.nil?