Class: NetHttp2::Request::Base
- Inherits:
-
Object
- Object
- NetHttp2::Request::Base
- Defined in:
- lib/net-http2/request/base.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#timeout ⇒ Object
readonly
Returns the value of attribute timeout.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #headers ⇒ Object
-
#initialize(method, uri, path, body, headers, options = {}) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(method, uri, path, body, headers, options = {}) ⇒ Base
Returns a new instance of Base.
10 11 12 13 14 15 16 17 |
# File 'lib/net-http2/request/base.rb', line 10 def initialize(method, uri, path, body, headers, ={}) @method = method @uri = uri @path = path @body = body @headers = headers @timeout = [:timeout] || DEFAULT_TIMEOUT end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
8 9 10 |
# File 'lib/net-http2/request/base.rb', line 8 def body @body end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
8 9 10 |
# File 'lib/net-http2/request/base.rb', line 8 def path @path end |
#timeout ⇒ Object (readonly)
Returns the value of attribute timeout.
8 9 10 |
# File 'lib/net-http2/request/base.rb', line 8 def timeout @timeout end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
8 9 10 |
# File 'lib/net-http2/request/base.rb', line 8 def uri @uri end |
Instance Method Details
#headers ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/net-http2/request/base.rb', line 19 def headers @headers.merge!({ ':scheme' => @uri.scheme, ':method' => @method, ':path' => @path, }) @headers.merge!('host' => @uri.host) unless @headers['host'] @headers.merge!('content-length' => @body.bytesize.to_s) if @body @headers end |