From c9dd4ff5e97968bb34a8f8e0b656049736acfef4 Mon Sep 17 00:00:00 2001 From: Caleb Bourg Date: Wed, 6 Nov 2024 07:45:45 -0500 Subject: [PATCH] use Context.insert removes a few redundant lines --- rama-http/src/layer/proxy_auth.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/rama-http/src/layer/proxy_auth.rs b/rama-http/src/layer/proxy_auth.rs index 4ba4f2e3..28809db4 100644 --- a/rama-http/src/layer/proxy_auth.rs +++ b/rama-http/src/layer/proxy_auth.rs @@ -5,7 +5,7 @@ use crate::header::PROXY_AUTHENTICATE; use crate::headers::{authorization::Credentials, HeaderMapExt, ProxyAuthorization}; use crate::{Request, Response, StatusCode}; -use rama_core::{context::Extensions, Context, Layer, Service}; +use rama_core::{Context, Layer, Service}; use rama_net::user::{auth::Authority, UserId}; use rama_utils::macros::define_inner_service_accessors; use std::fmt; @@ -197,9 +197,7 @@ where .unwrap()) } } else if self.allow_anonymous { - let mut user_ext = Extensions::new(); - user_ext.insert(UserId::Anonymous); - ctx.extend(user_ext); + ctx.insert(UserId::Anonymous); self.inner.serve(ctx, req).await } else {