Clients -
http :
HttpClient
Provides the HTTP actions for interacting with an HTTP server. Apart from the standard HTTP methods,
HttpClient.forward() and HttpClient.execute() functions are provided. More complex and specific endpoint types
can be created by wrapping this generic HTTP actions implementation.
Constructor
__init
(string url, ClientConfiguration? config)
- url string
- config ClientConfiguration? ()
Remote Methods
| post | The |
| head | The |
| put | The |
| execute | Invokes an HTTP call with the specified HTTP verb. |
| patch | The |
| delete | The |
| get | The |
| options | The |
| forward | The |
| submit | Submits an HTTP request to a service with the specified HTTP verb.
The |
| getResponse | Retrieves the |
| hasPromise | Checks whether a |
| getNextPromise | Retrieves the next available |
| getPromisedResponse | Retrieves the promised server push |
| rejectPromise | Rejects a |
Fields
- config ClientConfiguration (default {})
-
The configurations associated with the HttpClient
- url string
-
The URL of the remote HTTP endpoint
The HttpClient.post() function can be used to send HTTP POST requests to HTTP endpoints.
Parameters
- path string
-
Resource path
- message RequestMessage
-
An HTTP outbound request message or any payload of type
string,xml,json,byte[],io:ReadableByteChannelormime:Entity[]
-
Return Type
(Response | ClientError) The response for the request or an
http:ClientErrorif failed to establish communication with the upstream server
The HttpClient.head() function can be used to send HTTP HEAD requests to HTTP endpoints.
Parameters
- path string
-
Resource path
- message RequestMessage (default ())
-
An HTTP outbound request message or any payload of type
string,xml,json,byte[],io:ReadableByteChannelormime:Entity[]
-
Return Type
(Response | ClientError) The response for the request or an
ClientErrorif failed to establish communication with the upstream server
The HttpClient.put() function can be used to send HTTP PUT requests to HTTP endpoints.
Parameters
- path string
-
Resource path
- message RequestMessage
-
An HTTP outbound request message or any payload of type
string,xml,json,byte[],io:ReadableByteChannelormime:Entity[]
-
Return Type
(Response | ClientError) The response for the request or an
ClientErrorif failed to establish communication with the upstream server
Invokes an HTTP call with the specified HTTP verb.
Parameters
- httpVerb string
-
HTTP verb value
- path string
-
Resource path
- message RequestMessage
-
An HTTP outbound request message or any payload of type
string,xml,json,byte[],io:ReadableByteChannelormime:Entity[]
-
Return Type
(Response | ClientError) The response for the request or an
ClientErrorif failed to establish communication with the upstream server
The HttpClient.patch() function can be used to send HTTP PATCH requests to HTTP endpoints.
Parameters
- path string
-
Resource path
- message RequestMessage
-
An HTTP outbound request message or any payload of type
string,xml,json,byte[],io:ReadableByteChannelormime:Entity[]
-
Return Type
(Response | ClientError) The response for the request or an
ClientErrorif failed to establish communication with the upstream server
The HttpClient.delete() function can be used to send HTTP DELETE requests to HTTP endpoints.
Parameters
- path string
-
Resource path
- message RequestMessage (default ())
-
An optional HTTP outbound request message or any payload of type
string,xml,json,byte[],io:ReadableByteChannelormime:Entity[]
-
Return Type
(Response | ClientError) The response for the request or an
ClientErrorif failed to establish communication with the upstream server
The HttpClient.get() function can be used to send HTTP GET requests to HTTP endpoints.
Parameters
- path string
-
Request path
- message RequestMessage (default ())
-
An optional HTTP outbound request message or any payload of type
string,xml,json,byte[],io:ReadableByteChannelormime:Entity[]
-
Return Type
(Response | ClientError) The response for the request or an
ClientErrorif failed to establish communication with the upstream server
The HttpClient.options() function can be used to send HTTP OPTIONS requests to HTTP endpoints.
Parameters
- path string
-
Request path
- message RequestMessage (default ())
-
An optional HTTP outbound request message or any payload of type
string,xml,json,byte[],io:ReadableByteChannelormime:Entity[]
-
Return Type
(Response | ClientError) The response for the request or an
ClientErrorif failed to establish communication with the upstream server
The HttpClient.forward() function can be used to invoke an HTTP call with inbound request's HTTP verb
-
Return Type
(Response | ClientError) The response for the request or an
ClientErrorif failed to establish communication with the upstream server
Submits an HTTP request to a service with the specified HTTP verb.
The HttpClient.submit() function does not give out a Response as the result,
rather it returns an HttpFuture which can be used to do further interactions with the endpoint.
Parameters
- httpVerb string
-
The HTTP verb value
- path string
-
The resource path
- message RequestMessage
-
An HTTP outbound request message or any payload of type
string,xml,json,byte[],io:ReadableByteChannelormime:Entity[]
-
Return Type
(HttpFuture | ClientError) An
HttpFuturethat represents an asynchronous service invocation, or anClientErrorif the submission fails
Retrieves the Response for a previously submitted request.
Parameters
- httpFuture HttpFuture
-
The
HttpFuturerelated to a previous asynchronous invocation
-
Return Type
(Response | ClientError) An HTTP response message, or an
ClientErrorif the invocation fails
Checks whether a PushPromise exists for a previously submitted request.
Parameters
- httpFuture HttpFuture
-
The
HttpFuturerelates to a previous asynchronous invocation
-
Return Type
(boolean) A
booleanthat represents whether aPushPromiseexists
Retrieves the next available PushPromise for a previously submitted request.
Parameters
- httpFuture HttpFuture
-
The
HttpFuturerelates to a previous asynchronous invocation
-
Return Type
(PushPromise | ClientError) An HTTP Push Promise message, or an
ClientErrorif the invocation fails
Retrieves the promised server push Response message.
Parameters
- promise PushPromise
-
The related
PushPromise
-
Return Type
(Response | ClientError) A promised HTTP
Responsemessage, or anClientErrorif the invocation fails
Rejects a PushPromise. When a PushPromise is rejected, there is no chance of fetching a promised
response using the rejected promise.
Parameters
- promise PushPromise
-
The Push Promise to be rejected