diff options
author | Azul <azul@riseup.net> | 2016-12-05 14:38:43 +0100 |
---|---|---|
committer | Azul <azul@riseup.net> | 2016-12-05 14:38:43 +0100 |
commit | 8e4dca14c904c405fd56d27e6efe77ec17e80457 (patch) | |
tree | a74cdebc6ebcbf50bb6b5f8c47a055df94cf7e2a /lib/nickserver | |
parent | afdfd541dedf77c0cb2dba62edd364e7b145d1b5 (diff) |
bugfix: send empty json object on 404 rather than nilversion/0.9
sending nothing was keeping the connection alive.
Diffstat (limited to 'lib/nickserver')
-rw-r--r-- | lib/nickserver/couch_db/response.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/nickserver/couch_db/response.rb b/lib/nickserver/couch_db/response.rb index c6afe03..fe482a8 100644 --- a/lib/nickserver/couch_db/response.rb +++ b/lib/nickserver/couch_db/response.rb @@ -17,7 +17,11 @@ module Nickserver::CouchDB end def content - key_response if ok? && !empty? + if ok? && !empty? + key_response + else + not_found_response + end end protected @@ -26,6 +30,10 @@ module Nickserver::CouchDB format address: nick.to_s, openpgp: key end + def not_found_response + format({}) + end + def format(response) response.to_json end |