Get more axum stuff upgraded to 0.7

This commit is contained in:
Jonathan Kelley committed 2024-02-15 18:59:57 -08:00
1 parent 214a907adc
commit 64a321eacc
25 files changed
+202 -193

No files matched your search

+3 -3
View File
@@ -1,10 +1,10 @@
use crate::server::HotReloadState;
use axum::{
extract::{ws::Message, WebSocketUpgrade},
response::IntoResponse,
Extension, TypedHeader,
Extension,
};
use crate::server::HotReloadState;
use axum_extra::TypedHeader;
pub async fn hot_reload_handler(
ws: WebSocketUpgrade,
+4 -1
View File
@@ -19,6 +19,7 @@ use axum::{
routing::{get, get_service},
Router,
};
use axum_extra::TypedHeader;
use axum_server::tls_rustls::RustlsConfig;
use dioxus_cli_config::CrateConfig;
use dioxus_cli_config::WebHttpsConfig;
@@ -298,7 +299,9 @@ async fn setup_router(
.body(body)
.unwrap()
} else {
response.map(|body| body.into())
response.map(|body| body.try_into().unwrap())
// response.into_body()
// response.map(|body| body.into())
};
let headers = response.headers_mut();
headers.insert(
+10 -3
View File
@@ -17,6 +17,7 @@ impl ProxyClient {
fn new(url: Uri) -> Self {
let https = hyper_rustls::HttpsConnectorBuilder::new()
.with_native_roots()
.unwrap()
.https_or_http()
.enable_http1()
.build();
@@ -138,7 +139,9 @@ mod test {
.unwrap();
assert_eq!(resp.status(), StatusCode::OK);
assert_eq!(
hyper::body::to_bytes(resp.into_body()).await.unwrap(),
axum::body::to_bytes(resp.into_body(), usize::MAX)
.await
.unwrap(),
"backend: /api"
);
@@ -148,7 +151,9 @@ mod test {
.unwrap();
assert_eq!(resp.status(), StatusCode::OK);
assert_eq!(
hyper::body::to_bytes(resp.into_body()).await.unwrap(),
axum::body::to_bytes(resp.into_body(), usize::MAX)
.await
.unwrap(),
"backend: /api/"
);
@@ -162,7 +167,9 @@ mod test {
.unwrap();
assert_eq!(resp.status(), StatusCode::OK);
assert_eq!(
hyper::body::to_bytes(resp.into_body()).await.unwrap(),
axum::body::to_bytes(resp.into_body(), usize::MAX)
.await
.unwrap(),
"backend: /api/subpath"
);
backend_handle.abort();