Class: Vertx::HttpClientResponse

Inherits:
Object
  • Object
show all
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.

Author:

Instance Method Summary collapse

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

#cookiesObject

Get all cookies



458
459
460
461
462
463
# File 'lib/vertx/http.rb', line 458

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

#header(key) ⇒ String

Get a header value

Parameters:

  • key. (String)

    The key of the header.

Returns:

  • (String)

    the header value.



435
436
437
# File 'lib/vertx/http.rb', line 435

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

#headersMultiMap

Get all the headers in the response.

Returns:



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_codeFixNum

Returns the HTTP status code of the response.

Returns:

  • (FixNum)

    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_messageString

Returns the status message.

Returns:

  • (String)

    the status message



428
429
430
# File 'lib/vertx/http.rb', line 428

def status_message
  @j_del.statusMessage
end

#trailersMultiMap

Get all the trailers in the response.

Returns:



450
451
452
453
454
455
# File 'lib/vertx/http.rb', line 450

def trailers
  if !@trailers
    @trailers = MultiMap.new(@j_del.trailers)
  end
  @trailers
end