Method: HTTP::Message.new_response

Defined in:
lib/httpclient/http.rb

.new_response(body, req = nil) ⇒ Object

Creates a Message instance of response.

body

a String or an IO of response message body.



760
761
762
763
764
765
766
767
# File 'lib/httpclient/http.rb', line 760

def new_response(body, req = nil)
  m = new
  m.http_header.init_response(Status::OK, req)
  m.http_body = Body.new
  m.http_body.init_response(body)
  m.http_header.body_size = m.http_body.size || 0
  m
end