split up the nil? and empty? cases, because they are different
situationspull/21/head
parent
1e61a76ded
commit
cabb4daded
9
app.rb
9
app.rb
|
|
@ -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?
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue