Function http_request

Source
pub async fn http_request<T: DeserializeOwned + Send + 'static>(
    req: Request,
    configuration: &ConfigurationRestApi,
) -> Result<RestApiResponse<T>, ConnectorError>
Expand description

Sends an HTTP request with retry and error handling capabilities.

§Parameters

  • req: The HTTP request to be sent
  • configuration: REST API configuration containing client, retry settings, and other parameters

§Returns

A Result containing a RestApiResponse with deserialized data, or a ConnectorError if the request fails

§Errors

Returns various ConnectorError types based on HTTP response status, such as:

  • BadRequestError
  • UnauthorizedError
  • ForbiddenError
  • NotFoundError
  • RateLimitBanError
  • TooManyRequestsError
  • ServerError
  • ConnectorClientError

§Behavior

  • Supports request retries with configurable backoff
  • Handles gzip-encoded responses
  • Parses rate limit headers
  • Provides detailed error handling for different HTTP status codes