Skip to content

Commit 90e93a1

Browse files
tottotoctron
authored andcommitted
chore: use http crate directly
1 parent 9dc9f85 commit 90e93a1

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ futures-util = { version = "0.3", default-features = false, features = ["sink"]
3838
htmlescape = "0.3.1"
3939
humantime = "2"
4040
humantime-serde = "1"
41-
hyper = "1.1"
41+
http = "1.1"
4242
local-ip-address = "0.6.1"
4343
lol_html = "1.2.1"
4444
mime_guess = "2.0.4"

src/proxy.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use axum::{
1212
};
1313
use bytes::BytesMut;
1414
use futures_util::{sink::SinkExt, stream::StreamExt, TryStreamExt};
15-
use hyper::{header::HOST, HeaderMap};
15+
use http::{header::HOST, HeaderMap};
1616
use reqwest::header::HeaderValue;
1717
use std::sync::Arc;
1818
use tokio_tungstenite::{
@@ -81,8 +81,8 @@ fn make_outbound_uri(backend: &Uri, request: &Uri) -> anyhow::Result<Uri> {
8181
fn make_outbound_request(
8282
outbound_uri: &Uri,
8383
headers: HeaderMap,
84-
) -> anyhow::Result<hyper::Request<()>> {
85-
let mut request = hyper::Request::builder().uri(outbound_uri.to_string());
84+
) -> anyhow::Result<http::Request<()>> {
85+
let mut request = http::Request::builder().uri(outbound_uri.to_string());
8686

8787
let Some(outbound_host) = outbound_uri.authority().map(|authority| authority.host()) else {
8888
anyhow::bail!("No host found in outbound URI");
@@ -331,7 +331,7 @@ impl ProxyHandlerWebSocket {
331331
#[cfg(test)]
332332
mod tests {
333333
use axum::http::{HeaderValue, Uri};
334-
use hyper::{
334+
use http::{
335335
header::{
336336
ACCEPT, ACCEPT_ENCODING, CONNECTION, CONTENT_LENGTH, CONTENT_TYPE, COOKIE, DATE,
337337
EXPECT, HOST, USER_AGENT,
@@ -463,7 +463,7 @@ mod tests {
463463
.expect("Failed to create Request instance from inbound");
464464

465465
assert_eq!(have_outbound_req.uri(), &have_outbound_uri);
466-
assert_eq!(have_outbound_req.method(), &hyper::Method::GET);
466+
assert_eq!(have_outbound_req.method(), &http::Method::GET);
467467
assert_eq!(
468468
have_outbound_req
469469
.headers()

src/serve/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use axum::response::{IntoResponse, Response};
1616
use axum::routing::{get, get_service, Router};
1717
use axum_server::Handle;
1818
use futures_util::FutureExt;
19-
use hyper::HeaderMap;
19+
use http::HeaderMap;
2020
use proxy::{ProxyBuilder, ProxyClientOptions};
2121
use std::collections::{BTreeSet, HashMap};
2222
use std::net::{IpAddr, Ipv4Addr, SocketAddr};

src/serve/proxy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use anyhow::Context;
44
use axum::http::Uri;
55
use axum::Router;
66
use console::Emoji;
7-
use hyper::HeaderMap;
7+
use http::HeaderMap;
88
use reqwest::Client;
99
use std::collections::hash_map::Entry;
1010
use std::collections::HashMap;

0 commit comments

Comments
 (0)