lib/http/request/writer.rb
# Adds the headers to the header array for the given request body we are working
# with
Adds the headers to the header array for the given request body we are working
with
Adds the headers to the header array for the given request body we are working with
def add_body_type_headers
        if @body.is_a?(String) && !@headers[Headers::CONTENT_LENGTH]
          @request_header << "#{Headers::CONTENT_LENGTH}: #{@body.bytesize}"
        elsif @body.is_a?(Enumerable) && CHUNKED != @headers[Headers::TRANSFER_ENCODING]
          raise(RequestError, "invalid transfer encoding")
        end
      end
def add_body_type_headers if @body . is_a? ( String ) && ! @headers [ Headers :: CONTENT_LENGTH ] @request_header << "#{Headers::CONTENT_LENGTH}: #{@body.bytesize}" elsif @body . is_a? ( Enumerable ) && CHUNKED != @headers [ Headers :: TRANSFER_ENCODING ] raise ( RequestError , "invalid transfer encoding" ) end end
Adds the headers to the header array for the given request body we are working
with
Adds the headers to the header array for the given request body we are working with