new WebClient()
- Source:
Methods
close()
Close the client. Closing will close down any pooled connections.
Clients should always be closed after use.
delete(host, requestURI) → {HttpRequest}
Create an HTTP DELETE request to send to the server at the specified host and default port.
Parameters:
| Name | Type | Description |
|---|---|---|
host |
string | the host |
requestURI |
string | the relative URI |
Returns:
an HTTP client request object
- Type
- HttpRequest
deleteAbs(absoluteURI) → {HttpRequest}
Create an HTTP DELETE request to send to the server using an absolute URI, specifying a response handler to receive
the response
Parameters:
| Name | Type | Description |
|---|---|---|
absoluteURI |
string | the absolute URI |
Returns:
an HTTP client request object
- Type
- HttpRequest
get(host, requestURI) → {HttpRequest}
Create an HTTP GET request to send to the server at the specified host and default port.
Parameters:
| Name | Type | Description |
|---|---|---|
host |
string | the host |
requestURI |
string | the relative URI |
Returns:
an HTTP client request object
- Type
- HttpRequest
getAbs(absoluteURI) → {HttpRequest}
Create an HTTP GET request to send to the server using an absolute URI, specifying a response handler to receive
the response
Parameters:
| Name | Type | Description |
|---|---|---|
absoluteURI |
string | the absolute URI |
Returns:
an HTTP client request object
- Type
- HttpRequest
head(host, requestURI) → {HttpRequest}
Create an HTTP HEAD request to send to the server at the specified host and default port.
Parameters:
| Name | Type | Description |
|---|---|---|
host |
string | the host |
requestURI |
string | the relative URI |
Returns:
an HTTP client request object
- Type
- HttpRequest
headAbs(absoluteURI) → {HttpRequest}
Create an HTTP HEAD request to send to the server using an absolute URI, specifying a response handler to receive
the response
Parameters:
| Name | Type | Description |
|---|---|---|
absoluteURI |
string | the absolute URI |
Returns:
an HTTP client request object
- Type
- HttpRequest
patch(host, requestURI) → {HttpRequest}
Create an HTTP PATCH request to send to the server at the specified host and default port.
Parameters:
| Name | Type | Description |
|---|---|---|
host |
string | the host |
requestURI |
string | the relative URI |
Returns:
an HTTP client request object
- Type
- HttpRequest
patchAbs(absoluteURI) → {HttpRequest}
Create an HTTP PATCH request to send to the server using an absolute URI, specifying a response handler to receive
the response
Parameters:
| Name | Type | Description |
|---|---|---|
absoluteURI |
string | the absolute URI |
Returns:
an HTTP client request object
- Type
- HttpRequest
post(host, requestURI) → {HttpRequest}
Create an HTTP POST request to send to the server at the specified host and default port.
Parameters:
| Name | Type | Description |
|---|---|---|
host |
string | the host |
requestURI |
string | the relative URI |
Returns:
an HTTP client request object
- Type
- HttpRequest
postAbs(absoluteURI) → {HttpRequest}
Create an HTTP POST request to send to the server using an absolute URI, specifying a response handler to receive
the response
Parameters:
| Name | Type | Description |
|---|---|---|
absoluteURI |
string | the absolute URI |
Returns:
an HTTP client request object
- Type
- HttpRequest
put(host, requestURI) → {HttpRequest}
Create an HTTP PUT request to send to the server at the specified host and default port.
Parameters:
| Name | Type | Description |
|---|---|---|
host |
string | the host |
requestURI |
string | the relative URI |
Returns:
an HTTP client request object
- Type
- HttpRequest
putAbs(absoluteURI) → {HttpRequest}
Create an HTTP PUT request to send to the server using an absolute URI, specifying a response handler to receive
the response
Parameters:
| Name | Type | Description |
|---|---|---|
absoluteURI |
string | the absolute URI |
Returns:
an HTTP client request object
- Type
- HttpRequest
raw(customHttpMethod, host, requestURI) → {HttpRequest}
Create a request with a custom HTTP method to send to the server at the specified host and default port.
Parameters:
| Name | Type | Description |
|---|---|---|
customHttpMethod |
string | custom HTTP Method |
host |
string | the host |
requestURI |
string | the relative URI |
Returns:
an HTTP client request object
- Type
- HttpRequest
rawAbs(customHttpMethod, absoluteURI) → {HttpRequest}
Create a request with a custom HTTP method to send to the server using an absolute URI, specifying a response handler to receive
the response
Parameters:
| Name | Type | Description |
|---|---|---|
customHttpMethod |
string | custom HTTP Method |
absoluteURI |
string | the absolute URI |
Returns:
an HTTP client request object
- Type
- HttpRequest
request(method, serverAddress, options) → {HttpRequest}
Like WebClient#request using the
serverAddress parameter to connect to the
server instead of the options parameter.
The request host header will still be created from the options parameter.
Use to connect to a unix domain socket server.
Parameters:
| Name | Type | Description |
|---|---|---|
method |
Object | |
serverAddress |
SocketAddress | |
options |
Object |
- Source:
Returns:
- Type
- HttpRequest
requestAbs(method, serverAddress, absoluteURI) → {HttpRequest}
Like WebClient#requestAbs using the
serverAddress parameter to connect to the
server instead of the absoluteURI parameter.
The request host header will still be created from the absoluteURI parameter.
Use to connect to a unix domain socket server.
Parameters:
| Name | Type | Description |
|---|---|---|
method |
Object | |
serverAddress |
SocketAddress | |
absoluteURI |
string |
Returns:
- Type
- HttpRequest