class Addressable::URI

def request_uri=(new_request_uri)

Parameters:
  • new_request_uri (String, #to_str) -- The new HTTP request URI.
def request_uri=(new_request_uri)
  if !new_request_uri.respond_to?(:to_str)
    raise TypeError, "Can't convert #{new_request_uri.class} into String."
  end
  if self.absolute? && self.scheme !~ /^https?$/i
    raise InvalidURIError,
      "Cannot set an HTTP request URI for a non-HTTP URI."
  end
  new_request_uri = new_request_uri.to_str
  path_component = new_request_uri[/^([^\?]*)\??(?:.*)$/, 1]
  query_component = new_request_uri[/^(?:[^\?]*)\?(.*)$/, 1]
  path_component = path_component.to_s
  path_component = (!path_component.empty? ? path_component : SLASH)
  self.path = path_component
  self.query = query_component
  # Reset dependent values
  remove_composite_values
end