# Class: HttpClientRequest

## vertx-js/http_client_request~ HttpClientRequest

#### new HttpClientRequest()

Represents a client-side HTTP request.

Source:
  - vertx-js/http_client_request.js, line 36

### Methods

#### absoluteURI() → {string}

Source:
  - vertx-js/http_client_request.js, line 271

##### Returns:

the absolute URI corresponding to the the HTTP request

Type
  string

#### connection() → {HttpConnection}

Source:
  - vertx-js/http_client_request.js, line 522

##### Returns:

the HttpConnection associated with this request

Type
  HttpConnection

#### connectionHandler(handler) → {HttpClientRequest}

Set a connection handler called when an HTTP connection has been established.

##### Parameters:

Name | Type | Description
--- | --- | ---
`handler` | function | the handler

Source:
  - vertx-js/http_client_request.js, line 539

##### Returns:

a reference to this, so the API can be used fluently

Type
  HttpClientRequest

#### continueHandler(handler) → {HttpClientRequest}

If you send an HTTP request with the header `Expect` set to the value `100-continue` and the server responds with an interim HTTP response with a status code of `100` and a continue handler has been set using this method, then the `handler` will be called.

You can then continue to write data to the request body and later end it. This is normally used in conjunction with the HttpClientRequest#sendHead method to force the request header to be written before the request has ended.

##### Parameters:

Name | Type | Description
--- | --- | ---
`handler` | function |

Source:
  - vertx-js/http_client_request.js, line 391

##### Returns:

a reference to this, so the API can be used fluently

Type
  HttpClientRequest

#### drainHandler(handler) → {HttpClientRequest}

##### Parameters:

Name | Type | Description
--- | --- | ---
`handler` | function |

Source:
  - vertx-js/http_client_request.js, line 115

##### Returns:

Type
  HttpClientRequest

#### end(chunk, enc)

Same as HttpClientRequest#end but writes a String with the specified encoding

##### Parameters:

Name | Type | Description
--- | --- | ---
`chunk` | string |
`enc` | string |

Source:
  - vertx-js/http_client_request.js, line 427

#### endHandler(endHandler) → {HttpClientRequest}

##### Parameters:

Name | Type | Description
--- | --- | ---
`endHandler` | function |

Source:
  - vertx-js/http_client_request.js, line 173

##### Returns:

Type
  HttpClientRequest

#### exceptionHandler(handler) → {HttpClientRequest}

##### Parameters:

Name | Type | Description
--- | --- | ---
`handler` | function |

Source:
  - vertx-js/http_client_request.js, line 63

##### Returns:

Type
  HttpClientRequest

#### getHost() → {string}

Source:
  - vertx-js/http_client_request.js, line 340

##### Returns:

the request host. For HTTP/2 it returns the pseudo header otherwise it returns the header

Type
  string

#### getRawMethod() → {string}

Source:
  - vertx-js/http_client_request.js, line 243

##### Returns:

the raw value of the method this request sends

Type
  string

#### handler(handler) → {HttpClientRequest}

##### Parameters:

Name | Type | Description
--- | --- | ---
`handler` | function |

Source:
  - vertx-js/http_client_request.js, line 129

##### Returns:

Type
  HttpClientRequest

#### headers() → {MultiMap}

Source:
  - vertx-js/http_client_request.js, line 353

##### Returns:

The HTTP headers

Type
  MultiMap

#### isChunked() → {boolean}

Source:
  - vertx-js/http_client_request.js, line 216

##### Returns:

Is the request chunked?

Type
  boolean

#### method() → {Object}

The HTTP method for the request.

Source:
  - vertx-js/http_client_request.js, line 230

##### Returns:

Type
  Object

#### path() → {string}

Source:
  - vertx-js/http_client_request.js, line 297

##### Returns:

The path part of the uri. For example /somepath/somemorepath/someresource.foo

Type
  string

#### pause() → {HttpClientRequest}

Source:
  - vertx-js/http_client_request.js, line 145

##### Returns:

Type
  HttpClientRequest

#### pushHandler(handler) → {HttpClientRequest}

Set a push handler for this request.

The handler is called when the client receives a push promise from the server. The handler can be called multiple times, for each push promise.

The handler is called with a read-only HttpClientRequest, the following methods can be called:

- HttpClientRequest#method
- HttpClientRequest#uri
- HttpClientRequest#headers
- HttpClientRequest#getHost

In addition the handler should call the HttpClientRequest#handler method to set an handler to process the response.

##### Parameters:

Name | Type | Description
--- | --- | ---
`handler` | function | the handler

Source:
  - vertx-js/http_client_request.js, line 482

##### Returns:

a reference to this, so the API can be used fluently

Type
  HttpClientRequest

#### putHeader(name, value) → {HttpClientRequest}

Put an HTTP header

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | string | The header name
`value` | string | The header value

Source:
  - vertx-js/http_client_request.js, line 371

##### Returns:

a reference to this, so the API can be used fluently

Type
  HttpClientRequest

#### query() → {string}

Source:
  - vertx-js/http_client_request.js, line 310

##### Returns:

the query part of the uri. For example someparam=32&someotherparam=x

Type
  string

#### reset(code) → {boolean}

Reset this request:

- for HTTP/2, this performs send an HTTP/2 reset frame with the specified error `code`
- for HTTP/1.x, this closes the connection after the current in-flight requests are ended

When the request has not yet been sent, the request will be aborted and false is returned as indicator.

##### Parameters:

Name | Type | Description
--- | --- | ---
`code` | number | the error code

Source:
  - vertx-js/http_client_request.js, line 507

##### Returns:

true when reset has been performed

Type
  boolean

#### resume() → {HttpClientRequest}

Source:
  - vertx-js/http_client_request.js, line 159

##### Returns:

Type
  HttpClientRequest

#### sendHead(completionHandler) → {HttpClientRequest}

Like HttpClientRequest#sendHead but with an handler after headers have been sent. The handler will be called with the HttpVersion if it can be determined or null otherwise.

##### Parameters:

Name | Type | Description
--- | --- | ---
`completionHandler` | function |

Source:
  - vertx-js/http_client_request.js, line 407

##### Returns:

Type
  HttpClientRequest

#### setChunked(chunked) → {HttpClientRequest}

If chunked is true then the request will be set into HTTP chunked mode

##### Parameters:

Name | Type | Description
--- | --- | ---
`chunked` | boolean | true if chunked encoding

Source:
  - vertx-js/http_client_request.js, line 202

##### Returns:

a reference to this, so the API can be used fluently

Type
  HttpClientRequest

#### setFollowRedirects(followRedirects) → {HttpClientRequest}

##### Parameters:

Name | Type | Description
--- | --- | ---
`followRedirects` | boolean |

Source:
  - vertx-js/http_client_request.js, line 187

##### Returns:

Type
  HttpClientRequest

#### setHost(host) → {HttpClientRequest}

Set the request host.

For HTTP/2 it sets the pseudo header otherwise it sets the header

##### Parameters:

Name | Type | Description
--- | --- | ---
`host` | string |

Source:
  - vertx-js/http_client_request.js, line 326

##### Returns:

Type
  HttpClientRequest

#### setRawMethod(method) → {HttpClientRequest}

Set the value the method to send when the method is used.

##### Parameters:

Name | Type | Description
--- | --- | ---
`method` | string | the raw method

Source:
  - vertx-js/http_client_request.js, line 257

##### Returns:

a reference to this, so the API can be used fluently

Type
  HttpClientRequest

#### setTimeout(timeoutMs) → {HttpClientRequest}

Set's the amount of time after which if the request does not return any data within the timeout period an TimeoutException will be passed to the exception handler (if provided) and the request will be closed.

Calling this method more than once has the effect of canceling any existing timeout and starting the timeout from scratch.

##### Parameters:

Name | Type | Description
--- | --- | ---
`timeoutMs` | number | The quantity of time in milliseconds.

Source:
  - vertx-js/http_client_request.js, line 452

##### Returns:

a reference to this, so the API can be used fluently

Type
  HttpClientRequest

#### setWriteQueueMaxSize(maxSize) → {HttpClientRequest}

##### Parameters:

Name | Type | Description
--- | --- | ---
`maxSize` | number |

Source:
  - vertx-js/http_client_request.js, line 101

##### Returns:

Type
  HttpClientRequest

#### streamId() → {number}

Source:
  - vertx-js/http_client_request.js, line 580

##### Returns:

the id of the stream of this response, when it is not yet determined, i.e the request has not been yet sent or it is not supported HTTP/1.x

Type
  number

#### uri() → {string}

Source:
  - vertx-js/http_client_request.js, line 284

##### Returns:

The URI of the request.

Type
  string

#### write(chunk, enc) → {HttpClientRequest}

Write a String to the request body, encoded using the encoding `enc`.

##### Parameters:

Name | Type | Description
--- | --- | ---
`chunk` | string |
`enc` | string |

Source:
  - vertx-js/http_client_request.js, line 81

##### Returns:

@return a reference to this, so the API can be used fluently

Type
  HttpClientRequest

#### writeCustomFrame(type, flags, payload) → {HttpClientRequest}

Write an HTTP/2 frame to the request, allowing to extend the HTTP/2 protocol.

The frame is sent immediatly and is not subject to flow control.

This method must be called after the request headers have been sent and only for the protocol HTTP/2. The HttpClientRequest#sendHead should be used for this purpose.

##### Parameters:

Name | Type | Description
--- | --- | ---
`type` | number | the 8-bit frame type
`flags` | number | the 8-bit frame flags
`payload` | Buffer | the frame payload

Source:
  - vertx-js/http_client_request.js, line 563

##### Returns:

a reference to this, so the API can be used fluently

Type
  HttpClientRequest

#### writeQueueFull() → {boolean}

This will return `true` if there are more bytes in the write queue than the value set using HttpClientRequest#setWriteQueueMaxSize

Source:
  - vertx-js/http_client_request.js, line 50

##### Returns:

true if write queue is full

Type
  boolean