pub trait GraphqlSourceMiddleware: Send + Sync + 'static {
fn will_send_request<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
request: &'life1 mut Request,
ctx: &'life2 Context
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
{ ... }
fn did_receive_response<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
response: &'life1 mut Response,
ctx: &'life2 Context
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Self: 'async_trait,
{ ... }
}Expand description
Implement GraphqlSourceMiddleware for your source, if you want to modify requests to the subgraph before they’re sent and modify response after it.
Provided Methods
Override will_send_request to modify your gateway’s requests to the subgraph before they’re sent.
Override did_receive_response to modify your gateway’s response after request to the subgraph. It will not modify response of subscription.