Module: Chef::HTTP::SocketlessChefZeroClient::ResponseExts
- Defined in:
- lib/chef/http/socketless_chef_zero_client.rb
Overview
This module is extended into Net::HTTP Response objects created from Socketless Chef Zero responses.
Instance Method Summary collapse
-
#read_body(dest = nil, &block) ⇒ Object
Net::HTTP raises an error if #read_body is called with a block or file argument after the body has already been read from the network.
Instance Method Details
#read_body(dest = nil, &block) ⇒ Object
Net::HTTP raises an error if #read_body is called with a block or file argument after the body has already been read from the network.
Since we always set the body to the string response from Chef Zero and set the ‘@read` indicator variable, we have to patch this method or else streaming-style responses won’t work.
68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/chef/http/socketless_chef_zero_client.rb', line 68 def read_body(dest = nil, &block) if dest raise "responses from socketless #{ChefUtils::Dist::Zero::PRODUCT} can't be written to specific destination" end if block_given? yield(@body) else super end end |