mirror of
https://github.com/robertwayne/axum-htmx
synced 2024-11-23 20:02:50 +01:00
Update doc comments
This commit is contained in:
parent
d36468f9d5
commit
f4871d6e37
2 changed files with 21 additions and 16 deletions
|
@ -29,8 +29,8 @@ const MIDDLEWARE_DOUBLE_USE: &str =
|
||||||
"Configuration error: `axum_httpx::vary_middleware` is used twice";
|
"Configuration error: `axum_httpx::vary_middleware` is used twice";
|
||||||
|
|
||||||
/// Addresses [htmx caching issue](https://htmx.org/docs/#caching)
|
/// Addresses [htmx caching issue](https://htmx.org/docs/#caching)
|
||||||
/// by automatically adding a corresponding `Vary` header when [`HxRequest`], [`HxTarget`],
|
/// by automatically adding a corresponding `Vary` header when [`HxRequest`],
|
||||||
/// [`HxTrigger`], [`HxTriggerName`] or their combination is used.
|
/// [`HxTarget`], [`HxTrigger`], [`HxTriggerName`] or their combination is used.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct AutoVaryLayer;
|
pub struct AutoVaryLayer;
|
||||||
|
|
||||||
|
|
|
@ -10,13 +10,15 @@ const HX_TRIGGER_NAME: HeaderValue = HeaderValue::from_static(headers::HX_TRIGGE
|
||||||
|
|
||||||
/// The `Vary: HX-Request` header.
|
/// The `Vary: HX-Request` header.
|
||||||
///
|
///
|
||||||
/// You may want to add this header to the response if your handler responds differently based on
|
/// You may want to add this header to the response if your handler responds
|
||||||
/// the `HX-Request` request header.
|
/// 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
|
/// For example, if your server renders the full HTML when the `HX-Request`
|
||||||
/// `false`, and it renders a fragment of that HTML when `HX-Request: true`.
|
/// 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 <https://htmx.org/docs/#caching> for more information.
|
/// See <https://htmx.org/docs/#caching> for more information.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
@ -41,10 +43,11 @@ impl extractors::HxRequest {
|
||||||
|
|
||||||
/// The `Vary: HX-Target` header.
|
/// The `Vary: HX-Target` header.
|
||||||
///
|
///
|
||||||
/// You may want to add this header to the response if your handler responds differently based on
|
/// You may want to add this header to the response if your handler responds
|
||||||
/// the `HX-Target` request header.
|
/// 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 <https://htmx.org/docs/#caching> for more information.
|
/// See <https://htmx.org/docs/#caching> for more information.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
@ -69,10 +72,11 @@ impl extractors::HxTarget {
|
||||||
|
|
||||||
/// The `Vary: HX-Trigger` header.
|
/// The `Vary: HX-Trigger` header.
|
||||||
///
|
///
|
||||||
/// You may want to add this header to the response if your handler responds differently based on
|
/// You may want to add this header to the response if your handler responds
|
||||||
/// the `HX-Trigger` request header.
|
/// 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 <https://htmx.org/docs/#caching> for more information.
|
/// See <https://htmx.org/docs/#caching> for more information.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
@ -97,10 +101,11 @@ impl extractors::HxTrigger {
|
||||||
|
|
||||||
/// The `Vary: HX-Trigger-Name` header.
|
/// The `Vary: HX-Trigger-Name` header.
|
||||||
///
|
///
|
||||||
/// You may want to add this header to the response if your handler responds differently based on
|
/// You may want to add this header to the response if your handler responds
|
||||||
/// the `HX-Trigger-Name` request header.
|
/// 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 <https://htmx.org/docs/#caching> for more information.
|
/// See <https://htmx.org/docs/#caching> for more information.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
|
Loading…
Reference in a new issue