Class: HttpRequest

vertx-web-client-js/http_request~ HttpRequest

new HttpRequest()

A client-side HTTP request.

Source:

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:
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:
Returns:
a reference to this, so the API can be used fluently
Type
HttpRequest

copy() → {HttpRequest}

Copy this request
Source:
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:
Returns:
a reference to this, so the API can be used fluently
Type
HttpRequest

headers() → {MultiMap}

Source:
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:
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:
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:
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:
Returns:
a reference to this, so the API can be used fluently
Type
HttpRequest

queryParams() → {MultiMap}

Return the current query parameters.
Source:
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:

sendBuffer(body, handler)

Like HttpRequest#send but with an HTTP request body buffer.
Parameters:
Name Type Description
body Buffer the body
handler function
Source:

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:

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:

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:

sendStream(body, handler)

Like HttpRequest#send but with an HTTP request body stream.
Parameters:
Name Type Description
body ReadStream the body
handler function
Source:

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:
Returns:
a reference to this, so the API can be used fluently
Type
HttpRequest

ssl(value) → {HttpRequest}

Parameters:
Name Type Description
value boolean
Source:
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:
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:
Returns:
a reference to this, so the API can be used fluently
Type
HttpRequest