Clients -
http :
Client
The HTTP client provides the capability for initiating contact with a remote HTTP service. The API it provides includes functions for the standard HTTP methods, forwarding a received request and sending requests using custom HTTP verbs.
Constructor
__init
(string url, ClientConfiguration? config)
- url string
-
URL of the target service
- config ClientConfiguration? ()
-
The configurations to be used when initializing the client
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 | This just pass the request to actual network call. |
hasPromise | This just pass the request to actual network call. |
getNextPromise | This just pass the request to actual network call. |
getPromisedResponse | This just pass the request to actual network call. |
rejectPromise | This just pass the request to actual network call. |
Fields
- url string
-
Target service url
- config ClientConfiguration {}
-
The configurations associated with the client
- httpClient HttpClient
-
Chain of different HTTP clients which provides the capability for initiating contact with a remote HTTP service in resilient manner
The Client.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:ReadableByteChannel
ormime:Entity[]
-
Return Type
(Response | ClientError) The response for the request or an
http:ClientError
if failed to establish communication with the upstream server
The Client.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:ReadableByteChannel
ormime:Entity[]
-
Return Type
(Response | ClientError) The response for the request or an
http:ClientError
if failed to establish communication with the upstream server
The Client.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:ReadableByteChannel
ormime:Entity[]
-
Return Type
(Response | ClientError) The response for the request or an
http:ClientError
if 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:ReadableByteChannel
ormime:Entity[]
-
Return Type
(Response | ClientError) The response for the request or an
http:ClientError
if failed to establish communication with the upstream server
The Client.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:ReadableByteChannel
ormime:Entity[]
-
Return Type
(Response | ClientError) The response for the request or an
http:ClientError
if failed to establish communication with the upstream server
The Client.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:ReadableByteChannel
ormime:Entity[]
-
Return Type
(Response | ClientError) The response for the request or an
http:ClientError
if failed to establish communication with the upstream server
The Client.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:ReadableByteChannel
ormime:Entity[]
-
Return Type
(Response | ClientError) The response for the request or an
http:ClientError
if failed to establish communication with the upstream server
The Client.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:ReadableByteChannel
ormime:Entity[]
-
Return Type
(Response | ClientError) The response for the request or an
http:ClientError
if failed to establish communication with the upstream server
The Client.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
http:ClientError
if failed to establish communication with the upstream server
Submits an HTTP request to a service with the specified HTTP verb.
The Client.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:ReadableByteChannel
ormime:Entity[]
-
Return Type
(HttpFuture | ClientError) An
HttpFuture
that represents an asynchronous service invocation, or anhttp:ClientError
if the submission fails
This just pass the request to actual network call.
Parameters
- httpFuture HttpFuture
-
The
HttpFuture
relates to a previous asynchronous invocation
-
Return Type
(Response | ClientError) An HTTP response message, or an error if the invocation fails
This just pass the request to actual network call.
Parameters
- httpFuture HttpFuture
-
The
HttpFuture
relates to a previous asynchronous invocation
-
Return Type
(boolean) A
boolean
that represents whether aPushPromise
exists
This just pass the request to actual network call.
Parameters
- httpFuture HttpFuture
-
The
HttpFuture
relates to a previous asynchronous invocation
-
Return Type
(PushPromise | ClientError) An HTTP Push Promise message, or an error if the invocation fails
This just pass the request to actual network call.
Parameters
- promise PushPromise
-
The related
PushPromise
-
Return Type
(Response | ClientError) A promised HTTP
Response
message, or an error if the invocation fails
This just pass the request to actual network call.
Parameters
- promise PushPromise
-
The Push Promise to be rejected