Skip to main content

RecorderSession

Trait RecorderSession 

pub trait RecorderSession: Send + 'static {
    // Required methods
    fn record_response(
        self,
        response: HttpResponseCapture,
    ) -> impl Future<Output = Option<Extensions>> + Send;
    fn record_request_only(
        self,
    ) -> impl Future<Output = Option<Extensions>> + Send;

    // Provided method
    fn web_socket_capture(&self) -> Option<WebSocketCapture> { ... }
}
Available on crate features http and std only.
Expand description

One in-progress HTTP exchange owned by a Recorder.

Required Methods§

fn record_response( self, response: HttpResponseCapture, ) -> impl Future<Output = Option<Extensions>> + Send

Attach a response and its streaming body to this exchange.

This future must resolve after the recorder has accepted the stream, not after the response body ends. Otherwise returning a streaming response would deadlock on its own consumer.

fn record_request_only(self) -> impl Future<Output = Option<Extensions>> + Send

Finish an exchange which has no recordable response.

Provided Methods§

fn web_socket_capture(&self) -> Option<WebSocketCapture>

Return the capture handle for a WebSocket upgrade, when supported.

HARExportLayer calls this at most once per session, and only when it classified the request as a WebSocket handshake.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§