userver: clients::http::MiddlewareBase Class Reference
Loading...
Searching...
No Matches
clients::http::MiddlewareBase Class Reference

#include <userver/clients/http/middlewares/base.hpp>

Detailed Description

Base class for HTTP Client middlewares.

Definition at line 50 of file base.hpp.

Public Member Functions

 MiddlewareBase (const MiddlewareBase &)=delete
 
 MiddlewareBase (MiddlewareBase &&)=delete
 
MiddlewareBaseoperator= (const MiddlewareBase &)=delete
 
MiddlewareBaseoperator= (MiddlewareBase &&)=delete
 
virtual void HookCreateSpan (MiddlewareRequest &request, tracing::Span &span)
 The hook is called just after the "external" Span is created. You might want to add custom tags from the hook. The hook is called only once before any network interaction and is NOT called before each retry. The hook is executed in the context of the parent task which created the request. The hook does nothing by default.
 
virtual void HookPerformRequest (MiddlewareRequest &request)
 The hook is called before actual HTTP request sending and before DNS name resolution. This hook is called on each retry. The hook does nothing by default.
 
virtual void HookOnCompleted (MiddlewareRequest &request, Response &response)
 The hook is called after the HTTP response is received. It does not include timeout, network or other error. The hook does nothing by default.
 
virtual void HookOnError (MiddlewareRequest &request, std::error_code ec)
 The hook is called on timeout and other errors. The hook is not called for error HTTP responses, use HookOnCompleted instead. The hook does nothing by default.
 
virtual bool HookOnRetry (MiddlewareRequest &request)
 The hook is called before every call attempt except the first one. The hook allows retry by default.
 

Member Function Documentation

◆ HookOnCompleted()

virtual void clients::http::MiddlewareBase::HookOnCompleted ( MiddlewareRequest request,
Response response 
)
virtual

The hook is called after the HTTP response is received. It does not include timeout, network or other error. The hook does nothing by default.

Warning
The hook is called in libev thread, not in coroutine context! Do not do any heavy work here, offload it to other hooks.

◆ HookOnError()

virtual void clients::http::MiddlewareBase::HookOnError ( MiddlewareRequest request,
std::error_code  ec 
)
virtual

The hook is called on timeout and other errors. The hook is not called for error HTTP responses, use HookOnCompleted instead. The hook does nothing by default.

Warning
The hook is called in libev thread, not in coroutine context! Do not do any heavy work here, offload it to other hooks.

◆ HookOnRetry()

virtual bool clients::http::MiddlewareBase::HookOnRetry ( MiddlewareRequest request)
virtual

The hook is called before every call attempt except the first one. The hook allows retry by default.

Returns
whether the retry is allowed.

◆ HookPerformRequest()

virtual void clients::http::MiddlewareBase::HookPerformRequest ( MiddlewareRequest request)
virtual

The hook is called before actual HTTP request sending and before DNS name resolution. This hook is called on each retry. The hook does nothing by default.

Warning
The hook is called in libev thread, not in coroutine context! Do not do any heavy work here, offload it to other hooks.

The documentation for this class was generated from the following file: