mirror of
https://github.com/tokio-rs/axum.git
synced 2026-09-07 00:00:12 +02:00
Upgrade reqwest to 0.12 (#2688)
Signed-off-by: tison <[email protected]>
This commit is contained in:
+1
-1
@@ -117,7 +117,7 @@ anyhow = "1.0"
|
||||
axum-macros = { path = "../axum-macros", version = "0.4.1", features = ["__private"] }
|
||||
quickcheck = "1.0"
|
||||
quickcheck_macros = "1.0"
|
||||
reqwest = { version = "0.11.14", default-features = false, features = ["json", "stream", "multipart"] }
|
||||
reqwest = { version = "0.12", default-features = false, features = ["json", "stream", "multipart"] }
|
||||
rustversion = "1.0.9"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
|
||||
@@ -5,7 +5,7 @@ use http::{
|
||||
header::{HeaderName, HeaderValue},
|
||||
StatusCode,
|
||||
};
|
||||
use std::{convert::Infallible, future::IntoFuture, net::SocketAddr, str::FromStr};
|
||||
use std::{convert::Infallible, future::IntoFuture, net::SocketAddr};
|
||||
use tokio::net::TcpListener;
|
||||
use tower::make::Shared;
|
||||
use tower_service::Service;
|
||||
@@ -110,15 +110,7 @@ impl RequestBuilder {
|
||||
HeaderValue: TryFrom<V>,
|
||||
<HeaderValue as TryFrom<V>>::Error: Into<http::Error>,
|
||||
{
|
||||
// reqwest still uses http 0.2
|
||||
let key: HeaderName = key.try_into().map_err(Into::into).unwrap();
|
||||
let key = reqwest::header::HeaderName::from_bytes(key.as_ref()).unwrap();
|
||||
|
||||
let value: HeaderValue = value.try_into().map_err(Into::into).unwrap();
|
||||
let value = reqwest::header::HeaderValue::from_bytes(value.as_bytes()).unwrap();
|
||||
|
||||
self.builder = self.builder.header(key, value);
|
||||
|
||||
self
|
||||
}
|
||||
|
||||
@@ -170,14 +162,7 @@ impl TestResponse {
|
||||
}
|
||||
|
||||
pub(crate) fn headers(&self) -> http::HeaderMap {
|
||||
// reqwest still uses http 0.2 so have to convert into http 1.0
|
||||
let mut headers = http::HeaderMap::new();
|
||||
for (key, value) in self.response.headers() {
|
||||
let key = http::HeaderName::from_str(key.as_str()).unwrap();
|
||||
let value = http::HeaderValue::from_bytes(value.as_bytes()).unwrap();
|
||||
headers.insert(key, value);
|
||||
}
|
||||
headers
|
||||
self.response.headers().clone()
|
||||
}
|
||||
|
||||
pub(crate) async fn chunk(&mut self) -> Option<Bytes> {
|
||||
|
||||
Reference in New Issue
Block a user