fn call(&self, req: ServiceRequest) -> Self::Future {
let behai_header_value = req.headers().get("behai-header").expect("There was no behai-header on the request");
}
Sorry, I didn't read carefully your first comment and thought you wanted to access a header from the request.
Can you try this instead?
fn call(&self, req: ServiceRequest) -> Self::Future {
let fut = self.service.call(req);
Box::pin(async move {
let res: ServiceResponse<B> = fut.await.unwrap();
let behai_header_value = res.headers().get("behai-header").expect("There was no behai-header on the response");
Ok(res)
})
}
This actually IS the solution I've been looking for.
My thinking was wrong: I assumed having behai-header ONLY under specific situtations, while I should assume it's always present or not in all requests.
Thank you kindly for your helps @firebits.io. I appreciate it.