class HTTP::Client

def make_request_headers(opts)

Creates request headers with cookies (if any) merged in
def make_request_headers(opts)
  headers = opts.headers
  # Tell the server to keep the conn open
  headers[Headers::CONNECTION] = default_options.persistent? ? Connection::KEEP_ALIVE : Connection::CLOSE
  cookies = opts.cookies.values
  unless cookies.empty?
    cookies = opts.headers.get(Headers::COOKIE).concat(cookies).join("; ")
    headers[Headers::COOKIE] = cookies
  end
  if (auto_deflate = opts.feature(:auto_deflate))
    # We need to delete Content-Length header. It will be set automatically
    # by HTTP::Request::Writer
    headers.delete(Headers::CONTENT_LENGTH)
    headers[Headers::CONTENT_ENCODING] = auto_deflate.method
  end
  headers
end