aboutsummaryrefslogtreecommitdiffstats
path: root/lib/plum/client/client_session.rb
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-05-08 02:50:43 +0900
committerKazuki Yamaguchi <k@rhe.jp>2016-05-08 15:17:59 +0900
commitcd269bf5693bcb9a7b5b301bbd3a0eb65222b9fc (patch)
treefb5f981559be2e536ea1a9066ff31f9a047b2398 /lib/plum/client/client_session.rb
parent30a6b4df628937e4905b5932d4e43e1708332b62 (diff)
downloadplum-cd269bf5693bcb9a7b5b301bbd3a0eb65222b9fc.tar.gz
client: call the block passed to Client#request in Response#set_headers
This reduces code lines.
Diffstat (limited to 'lib/plum/client/client_session.rb')
-rw-r--r--lib/plum/client/client_session.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/plum/client/client_session.rb b/lib/plum/client/client_session.rb
index bfc24a7..0c7e366 100644
--- a/lib/plum/client/client_session.rb
+++ b/lib/plum/client/client_session.rb
@@ -42,7 +42,7 @@ module Plum
":scheme" => @config[:https] ? "https" : "http",
}.merge(headers)
- response = Response.new(**options)
+ response = Response.new(**options, &headers_cb)
@responses << response
stream = @plum.open_stream
stream.send_headers(headers, end_stream: !body)
@@ -50,7 +50,6 @@ module Plum
stream.on(:headers) { |resp_headers_raw|
response.send(:set_headers, resp_headers_raw.to_h)
- headers_cb.call(response) if headers_cb
}
stream.on(:data) { |chunk|
response.send(:add_chunk, chunk)