diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2016-05-08 02:50:43 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2016-05-08 15:17:59 +0900 |
commit | cd269bf5693bcb9a7b5b301bbd3a0eb65222b9fc (patch) | |
tree | fb5f981559be2e536ea1a9066ff31f9a047b2398 /lib/plum/client/client_session.rb | |
parent | 30a6b4df628937e4905b5932d4e43e1708332b62 (diff) | |
download | plum-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.rb | 3 |
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) |