module M2R::Response::ToRequest

Handles the logic of having response with proper http version and 'Connection' header in relation to given request

@api public

Public Instance Methods

to(request, identical = false) click to toggle source

params [Request] request Request that response handles params [true, false] identical Whether http version in response should be identical

to the received one.

@return [self] Response object @api public

# File lib/m2r/response/to_request.rb, line 15
def to(request, identical = false)
  # http://www.ietf.org/rfc/rfc2145.txt
  # 2.3 Which version number to send in a message
  http_version(request.http_version) if identical
  headers['Connection'] = 'close' if request.close?
  self
end