LuciadCPillar 2023.1.02
luciad::IHttpClient Class Referenceabstract

Interface for sending HTTP requests. More...

#include <luciad/net/http/IHttpClient.h>

Inheritance diagram for luciad::IHttpClient:
luciad::HttpClient

Public Member Functions

virtual ~IHttpClient ()=default
 
virtual luciad::expected< HttpResponse, ErrorInfosend (const HttpRequest &request, const CancellationToken &token)=0
 Returns the HTTP response for the given HTTP request. More...
 

Detailed Description

Interface for sending HTTP requests.

Implementations of this interface must be thread-safe.

See also the related guide on How to customize HTTP requests when loading data.

Since
2023.0

Constructor & Destructor Documentation

◆ ~IHttpClient()

virtual luciad::IHttpClient::~IHttpClient ( )
virtualdefault

Member Function Documentation

◆ send()

virtual luciad::expected< HttpResponse, ErrorInfo > luciad::IHttpClient::send ( const HttpRequest request,
const CancellationToken token 
)
pure virtual

Returns the HTTP response for the given HTTP request.

This method is synchronous and blocks until the request has been sent and the response has been received.

The request process can be canceled by the means of the cancellation token. It is up to the implementer to verify that the cancellation token state is set to true during the operation. When set to true this indicates that a HTTP response is no longer needed. The return value then can be an ErrorInfo object with the error code Canceled.

Parameters
requestHTTP request.
tokenCancellation token.
Returns
the HTTP response, error information otherwise.

Implemented in luciad::HttpClient.