Class: Async::HTTP::Request

Inherits:
Struct
  • Object
show all
Includes:
Body::Buffered::Reader
Defined in:
lib/async/http/request.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Body::Buffered::Reader

#finish, #read

Instance Attribute Details

#authorityObject

Returns the value of attribute authority

Returns:

  • (Object)

    the current value of authority



25
26
27
# File 'lib/async/http/request.rb', line 25

def authority
  @authority
end

#bodyObject

Returns the value of attribute body

Returns:

  • (Object)

    the current value of body



25
26
27
# File 'lib/async/http/request.rb', line 25

def body
  @body
end

#headersObject

Returns the value of attribute headers

Returns:

  • (Object)

    the current value of headers



25
26
27
# File 'lib/async/http/request.rb', line 25

def headers
  @headers
end

#methodObject

Returns the value of attribute method

Returns:

  • (Object)

    the current value of method



25
26
27
# File 'lib/async/http/request.rb', line 25

def method
  @method
end

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



25
26
27
# File 'lib/async/http/request.rb', line 25

def path
  @path
end

#versionObject

Returns the value of attribute version

Returns:

  • (Object)

    the current value of version



25
26
27
# File 'lib/async/http/request.rb', line 25

def version
  @version
end

Class Method Details

.[](method, path, headers, body) ⇒ Object



28
29
30
31
32
# File 'lib/async/http/request.rb', line 28

def self.[](method, path, headers, body)
	body = Body::Buffered.wrap(body)
	
	self.new(nil, method, path, nil, headers, body)
end

Instance Method Details

#idempotent?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/async/http/request.rb', line 34

def idempotent?
	method != 'POST' && (body.nil? || body.empty?)
end