Skip to content

Commit

Permalink
make cookies.delete("not_existing") not fail (#1132)
Browse files Browse the repository at this point in the history
make ```cookies.delete("not_existing")``` have same behaviour as ```session.delete("not_existing")```, when delete key that not exists, return nil instead of fail
  • Loading branch information
skojin authored May 3, 2020
1 parent b59d48d commit 563d259
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lucky/cookies/cookie_jar.cr
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Lucky::CookieJar
end

def delete(key : Key) : Nil
if cookie = cookies[key.to_s]
if cookie = cookies[key.to_s]?
cookie.expires(1.year.ago).value("")
set_cookies[key.to_s] = cookie
end
Expand Down

0 comments on commit 563d259

Please sign in to comment.