class Protocol::HTTP::Request
Attributes
body[RW]
headers[RW]
method[RW]
path[RW]
protocol[RW]
scheme[RW]
version[RW]
Public Class Methods
[](method, path, headers, body)
click to toggle source
# File lib/protocol/http/request.rb, line 64 def self.[](method, path, headers, body) body = Body::Buffered.wrap(body) headers = ::Protocol::HTTP::Headers[headers] self.new(nil, nil, method, path, nil, headers, body) end
new(scheme = nil, authority = nil, method = nil, path = nil, version = nil, headers = Headers.new, body = nil, protocol = nil)
click to toggle source
# File lib/protocol/http/request.rb, line 31 def initialize(scheme = nil, authority = nil, method = nil, path = nil, version = nil, headers = Headers.new, body = nil, protocol = nil) @scheme = scheme @authority = authority @method = method @path = path @version = version @headers = headers @body = body @protocol = protocol end
Public Instance Methods
call(connection)
click to toggle source
Send the request to the given connection.
# File lib/protocol/http/request.rb, line 52 def call(connection) connection.call(self) end
connect?()
click to toggle source
# File lib/protocol/http/request.rb, line 60 def connect? @method == Methods::CONNECT end
head?()
click to toggle source
# File lib/protocol/http/request.rb, line 56 def head? @method == Methods::HEAD end
idempotent?()
click to toggle source
# File lib/protocol/http/request.rb, line 71 def idempotent? @method != Methods::POST && (@body.nil? || @body.empty?) end
to_s()
click to toggle source
# File lib/protocol/http/request.rb, line 75 def to_s "#{@scheme}://#{@authority}: #{@method} #{@path} #{@version}" end