From cabb4daded8df2762c07c5d7fbef05a8572cf7be Mon Sep 17 00:00:00 2001 From: Adam Townsend Date: Thu, 12 Oct 2023 14:27:31 -0700 Subject: [PATCH] split up the nil? and empty? cases, because they are different situations --- app.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app.rb b/app.rb index 5bd4ef7..b8501a6 100644 --- a/app.rb +++ b/app.rb @@ -50,9 +50,14 @@ class App < Roda end url = r.params['url'] - if url.nil? or url.empty? + if url.nil? 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 if links.filter(:url => url).first.nil?