diff options
author | Azul <azul@riseup.net> | 2016-06-21 12:33:52 +0200 |
---|---|---|
committer | Azul <azul@riseup.net> | 2016-06-21 12:33:52 +0200 |
commit | cd67dfac8f764140c47e0fba9304eba168c7a25b (patch) | |
tree | fb955e0ff28f53e8f05758936694844a8565156b /lib/nickserver/request_handler.rb | |
parent | b185742d959a0a3854c5e628354a538a15bdea15 (diff) |
refactor: change send_response -> respond in em_server
This way the interface mimics the one of Celluloid Reels request.
request.respond status, content
Diffstat (limited to 'lib/nickserver/request_handler.rb')
-rw-r--r-- | lib/nickserver/request_handler.rb | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/lib/nickserver/request_handler.rb b/lib/nickserver/request_handler.rb index 26b6ec1..a3fd57d 100644 --- a/lib/nickserver/request_handler.rb +++ b/lib/nickserver/request_handler.rb @@ -38,7 +38,7 @@ module Nickserver source = Nickserver::Hkp::Source.new(adapter) end source.query(uid) do |response| - send_response(status: response.status, content: response.content) + send_response response.status, response.content end end @@ -64,19 +64,15 @@ module Nickserver end end def send_error(msg = "not supported") - send_response(status: 500, content: "500 #{msg}\n") + send_response 500, "500 #{msg}\n" end def send_not_found(msg = "Not Found") - send_response(status: 404, content: "404 #{msg}\n") + send_response 404, "404 #{msg}\n" end - def send_response(opts = {}) - responder.send_response default_response.merge(opts) - end - - def default_response - {status: 200, content_type: 'text/plain', content: ''} + def send_response(status = 200, content = '') + responder.respond status, content end attr_reader :responder, :adapter |