class Nastika::HTTP::Head
HEAD request
Attributes
headers[RW]
httpver[RW]
reqpath[RW]
Public Class Methods
new(reqpath=Nastika::Constants::DEFAULT_REQPATH, httpver=Nastika::Constants::DEFAULT_HTTPVER, headers=Nastika::Constants::DEFAULT_HEADERS)
click to toggle source
Initialize the Nasktika::HTTP object Params:
reqpath
-
Path to include in the request
httpver
-
Http version to use. Default is 1.0
headers
-
Any headers to send with the request.
# File lib/nastika/http_head_request.rb, line 16 def initialize(reqpath=Nastika::Constants::DEFAULT_REQPATH, httpver=Nastika::Constants::DEFAULT_HTTPVER, headers=Nastika::Constants::DEFAULT_HEADERS) self.reqpath = reqpath self.headers = headers self.httpver = httpver end
Public Instance Methods
to_s()
click to toggle source
Converts the request object to a string.
# File lib/nastika/http_head_request.rb, line 25 def to_s payload = "" payload += "HEAD #{self.reqpath} HTTP/#{self.httpver}\r\n" self.headers.each do |key, val| payload += "#{key}: #{val}\r\n" end payload += "\r\n" return payload end