Class: Vertx::HttpClientResponse

Inherits:
Object
  • Object
show all
Includes:
ReadStream
Defined in:
src/main/ruby_scripts/core/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.

Author:

Instance Method Summary (collapse)

Methods included from ReadStream

#data_handler, #end_handler, #exception_handler, #pause, #resume

Instance Method Details

- (Object) body_handler(&hndlr)

Set a handler to receive the entire body in one go - do not use this for large bodies


465
466
467
# File 'src/main/ruby_scripts/core/http.rb', line 465

def body_handler(&hndlr)
  @j_del.bodyHandler(hndlr)
end

- (String) header(key)

Get a header value

Parameters:

  • key. (String)
    The key of the header.

Returns:

  • (String)
    the header value.


433
434
435
# File 'src/main/ruby_scripts/core/http.rb', line 433

def header(key)
  @j_del.getHeader(key)
end

- (Hash) headers

Get all the headers in the response. If the response contains multiple headers with the same key, the values will be concatenated together into a single header with the same key value, with each value separated by a comma, as specified by http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2.

Returns:

  • (Hash)
    . A Hash of headers.


442
443
444
445
446
447
# File 'src/main/ruby_scripts/core/http.rb', line 442

def headers
  if !@headers
    @headers = @j_del.headers
  end
  @headers
end

- (FixNum) status_code

The HTTP status code of the response.

Returns:

  • (FixNum)
    the HTTP status code of the response.


426
427
428
# File 'src/main/ruby_scripts/core/http.rb', line 426

def status_code
  @status_code
end

- (Hash) trailers

Get all the trailers in the response. If the response contains multiple trailers with the same key, the values will be concatenated together into a single header with the same key value, with each value separated by a comma, as specified by http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2. Trailers will only be available in the response if the server has sent a HTTP chunked response where headers have been inserted by the server on the last chunk. In such a case they won't be available on the client until the last chunk has been received.

Returns:

  • (Hash)
    . A Hash of trailers.


457
458
459
460
461
462
# File 'src/main/ruby_scripts/core/http.rb', line 457

def trailers
  if !@trailers
    @trailers = @j_del.trailers
  end
  @trailers
end