# Class: HttpRequest

## vertx-web-client-js/http_request~ HttpRequest

#### new HttpRequest()

A client-side HTTP request.

Source:
  - vertx-web-client-js/http_request.js, line 34

### Methods

#### addQueryParam(paramName, paramValue) → {HttpRequest}

Add a query parameter to the request.

##### Parameters:

Name | Type | Description
--- | --- | ---
`paramName` | string | the param name
`paramValue` | string | the param value

Source:
  - vertx-web-client-js/http_request.js, line 189

##### Returns:

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

Type
  HttpRequest

#### as(responseCodec) → {HttpRequest}

Configure the request to decode the response with the `responseCodec`.

##### Parameters:

Name | Type | Description
--- | --- | ---
`responseCodec` | BodyCodec | the response codec

Source:
  - vertx-web-client-js/http_request.js, line 77

##### Returns:

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

Type
  HttpRequest

#### copy() → {HttpRequest}

Copy this request

Source:
  - vertx-web-client-js/http_request.js, line 249

##### Returns:

a copy of this request

Type
  HttpRequest

#### followRedirects(value) → {HttpRequest}

Set wether or not to follow the directs for the request.

##### Parameters:

Name | Type | Description
--- | --- | ---
`value` | boolean | true if redirections should be followed

Source:
  - vertx-web-client-js/http_request.js, line 220

##### Returns:

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

Type
  HttpRequest

#### headers() → {MultiMap}

Source:
  - vertx-web-client-js/http_request.js, line 139

##### Returns:

The HTTP headers

Type
  MultiMap

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

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

##### Parameters:

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

Source:
  - vertx-web-client-js/http_request.js, line 91

##### Returns:

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

Type
  HttpRequest

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

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

##### Parameters:

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

Source:
  - vertx-web-client-js/http_request.js, line 47

##### Returns:

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

Type
  HttpRequest

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

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

##### Parameters:

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

Source:
  - vertx-web-client-js/http_request.js, line 62

##### Returns:

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

Type
  HttpRequest

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

Configure the request 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.js, line 125

##### Returns:

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

Type
  HttpRequest

#### queryParams() → {MultiMap}

Return the current query parameters.

Source:
  - vertx-web-client-js/http_request.js, line 235

##### Returns:

the current query parameters

Type
  MultiMap

#### send(handler)

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

##### Parameters:

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

Source:
  - vertx-web-client-js/http_request.js, line 367

#### sendBuffer(body, handler)

Like HttpRequest#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.js, line 283

#### sendForm(body, handler)

Like HttpRequest#send but with an HTTP request `body` multimap encoded as form and the content type set to `application/x-www-form-urlencoded`.

When the content type header is previously set to `multipart/form-data` it will be used instead.

##### Parameters:

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

Source:
  - vertx-web-client-js/http_request.js, line 348

#### sendJson(body, handler)

Like HttpRequest#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.js, line 325

#### sendJsonObject(body, handler)

Like HttpRequest#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.js, line 304

#### sendStream(body, handler)

Like HttpRequest#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.js, line 263

#### setQueryParam(paramName, paramValue) → {HttpRequest}

Set a query parameter to the request.

##### Parameters:

Name | Type | Description
--- | --- | ---
`paramName` | string | the param name
`paramValue` | string | the param value

Source:
  - vertx-web-client-js/http_request.js, line 205

##### Returns:

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

Type
  HttpRequest

#### ssl(value) → {HttpRequest}

##### Parameters:

Name | Type | Description
--- | --- | ---
`value` | boolean |

Source:
  - vertx-web-client-js/http_request.js, line 155

##### Returns:

Type
  HttpRequest

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

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.js, line 173

##### Returns:

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

Type
  HttpRequest

#### uri(value) → {HttpRequest}

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

When the uri has query parameters, they are set in the HttpRequest#queryParams multimap, overwritting any parameters previously set.

##### Parameters:

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

Source:
  - vertx-web-client-js/http_request.js, line 109

##### Returns:

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

Type
  HttpRequest