mirror of
https://github.com/robertwayne/axum-htmx
synced 2024-11-23 20:02:50 +01:00
Fix typing mismatch
If we're going to use typed header names and values, we'll have to duplicate some of the string literals across the two. Not a big deal.
This commit is contained in:
parent
a81dff414c
commit
5b24a9522d
1 changed files with 9 additions and 7 deletions
|
@ -1,12 +1,12 @@
|
||||||
use axum_core::response::{IntoResponseParts, ResponseParts};
|
use axum_core::response::{IntoResponseParts, ResponseParts};
|
||||||
use http::header::{HeaderValue, VARY};
|
use http::header::{HeaderValue, VARY};
|
||||||
|
|
||||||
use crate::{extractors, headers, HxError};
|
use crate::{extractors, HxError};
|
||||||
|
|
||||||
const HX_REQUEST: HeaderValue = HeaderValue::from_static(headers::HX_REQUEST);
|
const HX_REQUEST: HeaderValue = HeaderValue::from_static("hx-request");
|
||||||
const HX_TARGET: HeaderValue = HeaderValue::from_static(headers::HX_TARGET);
|
const HX_TARGET: HeaderValue = HeaderValue::from_static("hx-target");
|
||||||
const HX_TRIGGER: HeaderValue = HeaderValue::from_static(headers::HX_TRIGGER);
|
const HX_TRIGGER: HeaderValue = HeaderValue::from_static("hx-trigger");
|
||||||
const HX_TRIGGER_NAME: HeaderValue = HeaderValue::from_static(headers::HX_TRIGGER_NAME);
|
const HX_TRIGGER_NAME: HeaderValue = HeaderValue::from_static("hx-trigger-name");
|
||||||
|
|
||||||
/// The `Vary: HX-Request` header.
|
/// The `Vary: HX-Request` header.
|
||||||
///
|
///
|
||||||
|
@ -125,10 +125,12 @@ impl extractors::HxTriggerName {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
|
||||||
use axum::{routing::get, Router};
|
|
||||||
use std::collections::hash_set::HashSet;
|
use std::collections::hash_set::HashSet;
|
||||||
|
|
||||||
|
use axum::{routing::get, Router};
|
||||||
|
|
||||||
|
use super::*;
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn multiple_headers() {
|
async fn multiple_headers() {
|
||||||
let app = Router::new().route("/", get(|| async { (VaryHxRequest, VaryHxTarget, "foo") }));
|
let app = Router::new().route("/", get(|| async { (VaryHxRequest, VaryHxTarget, "foo") }));
|
||||||
|
|
Loading…
Reference in a new issue