auth_header function

This commit is contained in:
2026-04-13 08:01:07 +02:00
parent 9a566b2a00
commit 3c5232c1c3

View File

@@ -18,3 +18,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
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)
}