Class: HttpRequestTemplate

vertx-web-client-js/http_request_template~ HttpRequestTemplate

new HttpRequestTemplate()

A template for configuring client-side HTTP requests.

Source:

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:
Returns:
Type
HttpResponseTemplate

host(value) → {HttpRequestTemplate}

Configure the template to use a new host value.
Parameters:
Name Type Description
value string
Source:
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:
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:
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:
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:
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:

sendBuffer(body, handler)

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

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:

sendStream(body, handler)

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

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:
Returns:
a new HttpRequestTemplate instance with the specified timeout
Type
HttpRequestTemplate