From f4871d6e37122833d09f6048ef2ca289f649a395 Mon Sep 17 00:00:00 2001 From: Rob Wagner Date: Mon, 24 Jun 2024 18:12:19 -0400 Subject: [PATCH] Update doc comments --- src/auto_vary.rs | 4 ++-- src/responders/vary.rs | 33 +++++++++++++++++++-------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/auto_vary.rs b/src/auto_vary.rs index ed1b9bf..28af482 100644 --- a/src/auto_vary.rs +++ b/src/auto_vary.rs @@ -29,8 +29,8 @@ const MIDDLEWARE_DOUBLE_USE: &str = "Configuration error: `axum_httpx::vary_middleware` is used twice"; /// Addresses [htmx caching issue](https://htmx.org/docs/#caching) -/// by automatically adding a corresponding `Vary` header when [`HxRequest`], [`HxTarget`], -/// [`HxTrigger`], [`HxTriggerName`] or their combination is used. +/// by automatically adding a corresponding `Vary` header when [`HxRequest`], +/// [`HxTarget`], [`HxTrigger`], [`HxTriggerName`] or their combination is used. #[derive(Clone)] pub struct AutoVaryLayer; diff --git a/src/responders/vary.rs b/src/responders/vary.rs index 6ddc175..9fbe149 100644 --- a/src/responders/vary.rs +++ b/src/responders/vary.rs @@ -10,13 +10,15 @@ const HX_TRIGGER_NAME: HeaderValue = HeaderValue::from_static(headers::HX_TRIGGE /// The `Vary: HX-Request` header. /// -/// You may want to add this header to the response if your handler responds differently based on -/// the `HX-Request` request header. +/// You may want to add this header to the response if your handler responds +/// differently based on the `HX-Request` request header. /// -/// For example, if your server renders the full HTML when the `HX-Request` header is missing or -/// `false`, and it renders a fragment of that HTML when `HX-Request: true`. +/// For example, if your server renders the full HTML when the `HX-Request` +/// header is missing or `false`, and it renders a fragment of that HTML when +/// `HX-Request: true`. /// -/// You probably need this only for `GET` requests, as other HTTP methods are not cached by default. +/// You probably need this only for `GET` requests, as other HTTP methods are +/// not cached by default. /// /// See for more information. #[derive(Debug, Clone)] @@ -41,10 +43,11 @@ impl extractors::HxRequest { /// The `Vary: HX-Target` header. /// -/// You may want to add this header to the response if your handler responds differently based on -/// the `HX-Target` request header. +/// You may want to add this header to the response if your handler responds +/// differently based on the `HX-Target` request header. /// -/// You probably need this only for `GET` requests, as other HTTP methods are not cached by default. +/// You probably need this only for `GET` requests, as other HTTP methods are +/// not cached by default. /// /// See for more information. #[derive(Debug, Clone)] @@ -69,10 +72,11 @@ impl extractors::HxTarget { /// The `Vary: HX-Trigger` header. /// -/// You may want to add this header to the response if your handler responds differently based on -/// the `HX-Trigger` request header. +/// You may want to add this header to the response if your handler responds +/// differently based on the `HX-Trigger` request header. /// -/// You probably need this only for `GET` requests, as other HTTP methods are not cached by default. +/// You probably need this only for `GET` requests, as other HTTP methods are +/// not cached by default. /// /// See for more information. #[derive(Debug, Clone)] @@ -97,10 +101,11 @@ impl extractors::HxTrigger { /// The `Vary: HX-Trigger-Name` header. /// -/// You may want to add this header to the response if your handler responds differently based on -/// the `HX-Trigger-Name` request header. +/// You may want to add this header to the response if your handler responds +/// differently based on the `HX-Trigger-Name` request header. /// -/// You probably need this only for `GET` requests, as other HTTP methods are not cached by default. +/// You probably need this only for `GET` requests, as other HTTP methods are +/// not cached by default. /// /// See for more information. #[derive(Debug, Clone)]