pub struct HttpResponseInterceptorContext { /* private fields */ }Expand description
Metadata view passed to response interceptors.
The HTTP status and originating method are immutable so interceptors cannot
invalidate the HttpClient::execute success-status contract after the
client has already accepted the response. Interceptors may still mutate
response headers and the final response URL.
Implementations§
Source§impl HttpResponseInterceptorContext
impl HttpResponseInterceptorContext
Sourcepub fn new(
status: StatusCode,
headers: HeaderMap,
url: Url,
method: Method,
) -> Self
pub fn new( status: StatusCode, headers: HeaderMap, url: Url, method: Method, ) -> Self
Creates a response interceptor context from explicit metadata parts.
§Parameters
status: Response status code. It is immutable after construction.headers: Response headers that interceptors may mutate.url: Final response URL that interceptors may replace.method: Originating request method. It is immutable after construction.
§Returns
New interceptor context.
Sourcepub fn with_log_sanitize_policy(self, policy: LogSanitizePolicy) -> Self
pub fn with_log_sanitize_policy(self, policy: LogSanitizePolicy) -> Self
Sourcepub fn from_meta(meta: &HttpResponseMeta) -> Self
pub fn from_meta(meta: &HttpResponseMeta) -> Self
Sourcepub fn status(&self) -> StatusCode
pub fn status(&self) -> StatusCode
Sourcepub fn headers_mut(&mut self) -> &mut HeaderMap
pub fn headers_mut(&mut self) -> &mut HeaderMap
Returns mutable response headers.
§Returns
Mutable header map applied back to HttpResponseMeta after all
response interceptors succeed.
Sourcepub fn retry_after_hint(&self) -> Option<Duration>
pub fn retry_after_hint(&self) -> Option<Duration>
Returns parsed Retry-After when status and headers provide one.
§Returns
Some(Duration) for retryable status codes with valid Retry-After;
otherwise None.
Trait Implementations§
Source§impl Clone for HttpResponseInterceptorContext
impl Clone for HttpResponseInterceptorContext
Source§fn clone(&self) -> HttpResponseInterceptorContext
fn clone(&self) -> HttpResponseInterceptorContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for HttpResponseInterceptorContext
impl RefUnwindSafe for HttpResponseInterceptorContext
impl Send for HttpResponseInterceptorContext
impl Sync for HttpResponseInterceptorContext
impl Unpin for HttpResponseInterceptorContext
impl UnsafeUnpin for HttpResponseInterceptorContext
impl UnwindSafe for HttpResponseInterceptorContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T, D> IntoConfigDefault<T> for Dwhere
D: IntoValueDefault<T>,
impl<T, D> IntoConfigDefault<T> for Dwhere
D: IntoValueDefault<T>,
Source§fn into_config_default(self) -> T
fn into_config_default(self) -> T
Converts this fallback value into
T.Source§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = Infallible
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
Source§impl<T> IntoValueDefault<T> for T
impl<T> IntoValueDefault<T> for T
Source§fn into_value_default(self) -> T
fn into_value_default(self) -> T
Converts this argument into the default value.