We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dfc222f commit b9e7066Copy full SHA for b9e7066
jwt-authorizer/tests/tests.rs
@@ -551,20 +551,15 @@ mod tests {
551
async fn jwt_custom_token_extractor() {
552
// Initialize custom token extractor
553
let token_extractor: TokenExtractorFn = Arc::new(Box::new(|headers| {
554
- let Some(custom_header) = headers.get("X-Custom-Authorization") else {
555
- return None;
556
- };
+ let custom_header = headers.get("X-Custom-Authorization")?;
557
558
let Ok(custom_header_str) = custom_header.to_str() else {
559
return None;
560
};
561
562
let token = custom_header_str.split("Bearer ");
563
564
- match token.last() {
565
- Some(t) => Some(t.to_string()),
566
- None => None,
567
- }
+ token.last().map(|t| t.to_string())
568
}));
569
570
// OK
0 commit comments