Object
Represents an HTTP request and contains various methods for customizing that request.
Available attribute writers.
Returns the HTTPI::Authentication object.
# File lib/httpi/request.rb, line 74 def auth @auth ||= Auth::Config.new end
Returns whether any authentication credentials were specified.
# File lib/httpi/request.rb, line 79 def auth? !!auth.type end
Sets a body request given a String or a Hash.
# File lib/httpi/request.rb, line 69 def body=(params) @body = params.kind_of?(Hash) ? Rack::Utils.build_query(params) : params end
Adds a header information to accept gzipped content.
# File lib/httpi/request.rb, line 61 def gzip headers["Accept-Encoding"] = "gzip,deflate" end
Returns a Hash of HTTP headers. Defaults to return an empty Hash.
# File lib/httpi/request.rb, line 51 def headers @headers ||= Rack::Utils::HeaderHash.new end
Sets the Hash of HTTP headers.
# File lib/httpi/request.rb, line 56 def headers=(headers) @headers = Rack::Utils::HeaderHash.new(headers) end
Expects a Hash of args to assign.
# File lib/httpi/request.rb, line 84 def mass_assign(args) ATTRIBUTES.each { |key| send("#{key}=", args[key]) if args[key] } end
Sets the proxy to use. Raises an ArgumentError unless the proxy is valid.
# File lib/httpi/request.rb, line 34 def proxy=(proxy) @proxy = normalize_url! proxy end
Generated with the Darkfish Rdoc Generator 2.