# Class: HttpRequestTemplate

## vertx-web-client-js/http_request_template~ HttpRequestTemplate

#### new HttpRequestTemplate()

A template for configuring client-side HTTP requests.

Source:
  - vertx-web-client-js/http_request_template.js, line 33

### Methods

#### bufferBody() → {HttpResponseTemplate}

Configure to buffer the body and returns a [< Buffer >] HttpResponseTemplate for further configuration of the response or [#send(Handler) sending] HttpResponseTemplate the request.

Source:
  - vertx-web-client-js/http_request_template.js, line 214

##### Returns:

Type
  HttpResponseTemplate

#### host(value) → {HttpRequestTemplate}

Configure the template to use a new host `value`.

##### Parameters:

Name | Type | Description
--- | --- | ---
`value` | string |

Source:
  - vertx-web-client-js/http_request_template.js, line 73

##### Returns:

a new `HttpRequestTemplate` instance with the specified host `value`

Type
  HttpRequestTemplate

#### method(value) → {HttpRequestTemplate}

Configure the template to use a new method `value`.

##### Parameters:

Name | Type | Description
--- | --- | ---
`value` | Object |

Source:
  - vertx-web-client-js/http_request_template.js, line 45

##### Returns:

a new `HttpRequestTemplate` instance with the specified method `value`

Type
  HttpRequestTemplate

#### port(value) → {HttpRequestTemplate}

Configure the template to use a new port `value`.

##### Parameters:

Name | Type | Description
--- | --- | ---
`value` | number |

Source:
  - vertx-web-client-js/http_request_template.js, line 59

##### Returns:

a new `HttpRequestTemplate` instance with the specified port `value`

Type
  HttpRequestTemplate

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

Configure the template to add a new HTTP header.

##### Parameters:

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

Source:
  - vertx-web-client-js/http_request_template.js, line 102

##### Returns:

a new `HttpRequestTemplate` instance with the specified header

Type
  HttpRequestTemplate

#### requestURI(value) → {HttpRequestTemplate}

Configure the template to use a new request URI `value`.

##### Parameters:

Name | Type | Description
--- | --- | ---
`value` | string |

Source:
  - vertx-web-client-js/http_request_template.js, line 87

##### Returns:

a new `HttpRequestTemplate` instance with the specified request URI `value`

Type
  HttpRequestTemplate

#### send(handler)

Send a request, the `handler` will receive the response as an .

##### Parameters:

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

Source:
  - vertx-web-client-js/http_request_template.js, line 193

#### sendBuffer(body, handler)

Like HttpRequestTemplate#send but with an HTTP request `body` buffer.

##### Parameters:

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

Source:
  - vertx-web-client-js/http_request_template.js, line 153

#### sendJson(body, handler)

Like HttpRequestTemplate#send but with an HTTP request `body` object encoded as json and the content type set to `application/json`.

##### Parameters:

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

Source:
  - vertx-web-client-js/http_request_template.js, line 174

#### sendStream(body, handler)

Like HttpRequestTemplate#send but with an HTTP request `body` stream.

##### Parameters:

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

Source:
  - vertx-web-client-js/http_request_template.js, line 133

#### timeout(value) → {HttpRequestTemplate}

Configures the amount of time in milliseconds after which if the request does not return any data within the timeout period an TimeoutException fails the request.

Setting zero or a negative `value` disables the timeout.

##### Parameters:

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

Source:
  - vertx-web-client-js/http_request_template.js, line 119

##### Returns:

a new `HttpRequestTemplate` instance with the specified timeout

Type
  HttpRequestTemplate