-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
questionA question (converts to discussion)A question (converts to discussion)
Description
I notice there are two guards: request guard and data guard. Request guard implements from_request and data guard implements from_data. But is there a way to get the request body in request guard?
I'm trying to do hmac calculation in the guard methods but I can't find a way to get the request body content. I can only get the headers.
This is what I was doing:
pub struct Hmac_str(pub String);
impl<'r, 'a> FromRequest<'r, 'a> for Hmac_str {
type Error = ();
fn from_request(request: &'r Request<'a>) -> request::Outcome<Hmac_str, ()> {
...
// get headers and body to calculate hmac string
}
}
I was also reading this guide https://api.rocket.rs/rocket/request/trait.FromRequest.html but I find that sending apikey can be prone to man-in-middle attack so was trying out hmac which I need to access the request content.
Metadata
Metadata
Assignees
Labels
questionA question (converts to discussion)A question (converts to discussion)