auth_header function
This commit is contained in:
@@ -18,3 +18,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn auth_header(mut req: Request<()>) -> Result<Request<()>, InvalidMetadataValue> {
|
||||||
|
|
||||||
|
let token: MetadataValue<_> = "Bearer my-secret-token".parse()?;
|
||||||
|
|
||||||
|
|
||||||
|
req.metadata_mut().insert("x-goog-api-key", token).expect("WHAT");
|
||||||
|
Ok(req)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user