Interface IHttpInvoker
An interface that makes HTTP calls to a remote service.
public interface IHttpInvoker
Methods
Invoke(string, string, object?)
Invokes the remote HTTP service and returns the response as an object. Note this method is deprecated. Rather use InvokeAsync(string, string, object?, in CancellationToken)
Dictionary<string, object>? Invoke(string url, string method = "GET", object? payload = null)
Parameters
Returns
- Dictionary<string, object>
The response object.
InvokeAsync(string, string, object?, in CancellationToken)
Invokes the remote HTTP service and returns the response as an object asynchronously.
Task<Dictionary<string, object>?> InvokeAsync(string url, string method = "GET", object? payload = null, in CancellationToken cancellationToken = default)
Parameters
url
stringThe URL.
method
stringThe supported HTTP method.
payload
objectThe optional post payload.
cancellationToken
CancellationTokenThe optional CancellationToken used to signal that the request should be cancelled.
Returns
- Task<Dictionary<string, object>>
The response object.