Client: HttpClient
Lies inside every type of client in the chain holding the native client connector. More complex and specific endpoint types are created by wrapping this generic HTTP actions implementation internally.
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. |
getResponse | Retrieves the |
hasPromise | Checks whether an |
getNextPromise | Retrieves the next available |
getPromisedResponse | Retrieves the promised server push |
rejectPromise | Rejects an |
post
function post(string path, RequestMessage message) returns Response | ClientError
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 or any allowed payload
Return Type
(Response | ClientError)The response or an http:ClientError
if failed to establish the communication with the upstream server
head
function head(string path, RequestMessage message) returns Response | ClientError
The HttpClient.head()
function can be used to send HTTP HEAD requests to HTTP endpoints.
Parameters
- path string
Resource path
- message RequestMessage (default ())
An optional HTTP outbound request or any allowed payload
Return Type
(Response | ClientError)The response or an http:ClientError
if failed to establish the communication with the upstream server
put
function put(string path, RequestMessage message) returns Response | ClientError
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 or any allowed payload
Return Type
(Response | ClientError)The response or an http:ClientError
if failed to establish the communication with the upstream server
execute
function execute(string httpVerb, string path, RequestMessage message) returns Response | ClientError
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 or any allowed payload
Return Type
(Response | ClientError)The response or an http:ClientError
if failed to establish the communication with the upstream server
patch
function patch(string path, RequestMessage message) returns Response | ClientError
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 or any allowed payload
Return Type
(Response | ClientError)The response or an http:ClientError
if failed to establish the communication with the upstream server
delete
function delete(string path, RequestMessage message) returns Response | ClientError
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 or any allowed payload
Return Type
(Response | ClientError)The response or an http:ClientError
if failed to establish the communication with the upstream server
get
function get(string path, RequestMessage message) returns Response | ClientError
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 or any allowed payload
Return Type
(Response | ClientError)The response or an http:ClientError
if failed to establish the communication with the upstream server
options
function options(string path, RequestMessage message) returns Response | ClientError
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 or any allowed payload
Return Type
(Response | ClientError)The response or an http:ClientError
if failed to establish the communication with the upstream server
forward
function forward(string path, Request request) returns Response | ClientError
The HttpClient.forward()
function can be used to invoke an HTTP call with inbound request's HTTP verb
Return Type
(Response | ClientError)The response or an http:ClientError
if failed to establish the communication with the upstream server
submit
function submit(string httpVerb, string path, RequestMessage message) returns HttpFuture | ClientError
Submits an HTTP request to a service with the specified HTTP verb.
The HttpClient->submit()
function does not give out an http:Response
as the result.
Rather, it returns an http: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 or any allowed payload
Return Type
(HttpFuture | ClientError)An http:HttpFuture
that represents an asynchronous service invocation, or else an http:ClientError
if the submission fails
getResponse
function getResponse(HttpFuture httpFuture) returns Response | ClientError
Retrieves the http:Response
for a previously-submitted request.
Parameters
- httpFuture HttpFuture
The http:HttpFuture
related to a previous asynchronous invocation
Return Type
(Response | ClientError)An http:Response
message or else an http:ClientError
if the invocation fails
hasPromise
function hasPromise(HttpFuture httpFuture) returns boolean
Checks whether an http:PushPromise
exists for a previously-submitted request.
Parameters
- httpFuture HttpFuture
The http:HttpFuture
related to a previous asynchronous invocation
getNextPromise
function getNextPromise(HttpFuture httpFuture) returns PushPromise | ClientError
Retrieves the next available http:PushPromise
for a previously-submitted request.
Parameters
- httpFuture HttpFuture
The http:HttpFuture
related to a previous asynchronous invocation
Return Type
(PushPromise | ClientError)An http:PushPromise
message or else an http:ClientError
if the invocation fails
getPromisedResponse
function getPromisedResponse(PushPromise promise) returns Response | ClientError
Retrieves the promised server push http:Response
message.
Parameters
- promise PushPromise
The related http:PushPromise
Return Type
(Response | ClientError)A promised http:Response
message or else an http:ClientError
if the invocation fails
rejectPromise
function rejectPromise(PushPromise promise)
Rejects an http:PushPromise
. When an http: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