Class: Vertx::HttpClientResponse
- Inherits:
-
Object
- Object
- Vertx::HttpClientResponse
- Includes:
- ReadStream
- Defined in:
- lib/vertx/http.rb
Overview
Encapsulates a client-side HTTP response.
An instance of this class is provided to the user via a handler that was specified when one of the HTTP method operations, or the generic Vertx::HttpClient#request method was called on an instance of HttpClient.
Instance Method Summary collapse
-
#body_handler(&hndlr) ⇒ Object
Set a handler to receive the entire body in one go - do not use this for large bodies.
-
#cookies ⇒ Object
Get all cookies.
-
#header(key) ⇒ String
Get a header value.
-
#headers ⇒ MultiMap
Get all the headers in the response.
-
#initialize(j_del) ⇒ HttpClientResponse
constructor
A new instance of HttpClientResponse.
-
#status_code ⇒ FixNum
The HTTP status code of the response.
-
#status_message ⇒ String
The status message.
-
#trailers ⇒ MultiMap
Get all the trailers in the response.
Methods included from ReadStream
#_to_read_stream, #data_handler, #end_handler, #exception_handler, #pause, #resume
Constructor Details
#initialize(j_del) ⇒ HttpClientResponse
Returns a new instance of HttpClientResponse.
418 419 420 |
# File 'lib/vertx/http.rb', line 418 def initialize(j_del) @j_del = j_del end |
Instance Method Details
#body_handler(&hndlr) ⇒ Object
Set a handler to receive the entire body in one go - do not use this for large bodies
466 467 468 469 |
# File 'lib/vertx/http.rb', line 466 def body_handler(&hndlr) @j_del.bodyHandler(hndlr) self end |
#cookies ⇒ Object
Get all cookies
458 459 460 461 462 463 |
# File 'lib/vertx/http.rb', line 458 def if !@cookies @cookies = @j_del. end @cookies end |
#header(key) ⇒ String
Get a header value
435 436 437 |
# File 'lib/vertx/http.rb', line 435 def header(key) @j_del.getHeader(key) end |
#headers ⇒ MultiMap
Get all the headers in the response.
441 442 443 444 445 446 |
# File 'lib/vertx/http.rb', line 441 def headers if !@headers @headers = MultiMap.new(@j_del.headers) end @headers end |
#status_code ⇒ FixNum
Returns the HTTP status code of the response.
423 424 425 |
# File 'lib/vertx/http.rb', line 423 def status_code @j_del.statusCode end |
#status_message ⇒ String
Returns the status message.
428 429 430 |
# File 'lib/vertx/http.rb', line 428 def @j_del.statusMessage end |