Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): bump reqwest from v0.11.18 to v0.12.2 #4247

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
264 changes: 203 additions & 61 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 3 additions & 7 deletions crates/analytics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ edition = "2021"

[dependencies]
# First party crates
api_models = { version = "0.1.0", path = "../api_models", features = [
"errors",
] }
api_models = { version = "0.1.0", path = "../api_models", features = ["errors"] }
storage_impl = { version = "0.1.0", path = "../storage_impl", default-features = false }
common_utils = { version = "0.1.0", path = "../common_utils" }
external_services = { version = "0.1.0", path = "../external_services", default-features = false }
Expand All @@ -21,9 +19,7 @@ router_env = { version = "0.1.0", path = "../router_env", features = [
"log_extra_implicit_fields",
"log_custom_entries_to_extra",
] }
diesel_models = { version = "0.1.0", path = "../diesel_models", features = [
"kv_store",
] }
diesel_models = { version = "0.1.0", path = "../diesel_models", features = ["kv_store"] }

#Third Party dependencies
actix-web = "4.3.1"
Expand All @@ -36,7 +32,7 @@ error-stack = "0.4.1"
futures = "0.3.28"
opensearch = { version = "2.2.0", features = ["aws-auth"] }
once_cell = "1.18.0"
reqwest = { version = "0.11.18", features = ["serde_json"] }
reqwest = { version = "0.12.2", features = ["json"] }
serde = { version = "1.0.193", features = ["derive", "rc"] }
serde_json = "1.0.108"
sqlx = { version = "0.6.3", features = [
Expand Down
2 changes: 1 addition & 1 deletion crates/analytics/src/clickhouse.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::sync::Arc;

use actix_web::http::StatusCode;
use common_utils::errors::ParsingError;
use error_stack::{report, Report, ResultExt};
use reqwest::StatusCode;
use router_env::logger;
use time::PrimitiveDateTime;

Expand Down
2 changes: 1 addition & 1 deletion crates/api_models/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ recon = []
actix-web = { version = "4.3.1", optional = true }
error-stack = "0.4.1"
mime = "0.3.17"
reqwest = { version = "0.11.18", optional = true }
reqwest = { version = "0.12.2", optional = true }
serde = { version = "1.0.193", features = ["derive"] }
serde_json = "1.0.108"
strum = { version = "0.25", features = ["derive"] }
Expand Down
4 changes: 2 additions & 2 deletions crates/api_models/src/errors/actix.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use super::types::ApiErrorResponse;

impl actix_web::ResponseError for ApiErrorResponse {
fn status_code(&self) -> reqwest::StatusCode {
use reqwest::StatusCode;
fn status_code(&self) -> actix_web::http::StatusCode {
use actix_web::http::StatusCode;

match self {
Self::Unauthorized(_) => StatusCode::UNAUTHORIZED,
Expand Down
2 changes: 1 addition & 1 deletion crates/api_models/src/errors/types.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::borrow::Cow;

use reqwest::StatusCode;
use actix_web::http::StatusCode;
use serde::Serialize;

#[derive(Debug, serde::Serialize)]
Expand Down
2 changes: 1 addition & 1 deletion crates/common_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ phonenumber = "0.3.3"
quick-xml = { version = "0.28.2", features = ["serialize"] }
rand = "0.8.5"
regex = "1.8.4"
reqwest = { version = "0.11.18", features = ["json", "native-tls", "gzip", "multipart"] }
reqwest = { version = "0.12.2", features = ["json", "native-tls", "gzip", "multipart"] }
ring = { version = "0.16.20", features = ["std"] }
rustc-hash = "1.1.0"
serde = { version = "1.0.193", features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/drainer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ diesel = { version = "2.1.0", features = ["postgres"] }
error-stack = "0.4.1"
mime = "0.3.17"
once_cell = "1.18.0"
reqwest = { version = "0.11.18" }
reqwest = { version = "0.12.2" }
serde = "1.0.193"
serde_json = "1.0.108"
serde_path_to_error = "0.1.14"
Expand Down
4 changes: 2 additions & 2 deletions crates/drainer/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ impl From<error_stack::Report<redis::errors::RedisError>> for DrainerError {
}

impl actix_web::ResponseError for HealthCheckError {
fn status_code(&self) -> reqwest::StatusCode {
use reqwest::StatusCode;
fn status_code(&self) -> actix_web::http::StatusCode {
use actix_web::http::StatusCode;

match self {
Self::DbError { .. } | Self::RedisError { .. } => StatusCode::INTERNAL_SERVER_ERROR,
Expand Down
2 changes: 1 addition & 1 deletion crates/pm_auth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ router_env = { version = "0.1.0", path = "../router_env", features = ["log_extra
async-trait = "0.1.66"
bytes = "1.4.0"
error-stack = "0.4.1"
http = "0.2.9"
http = "1.1.0"
mime = "0.3.17"
serde = "1.0.193"
serde_json = "1.0.108"
Expand Down
2 changes: 1 addition & 1 deletion crates/router/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ qrcode = "0.12.0"
rand = "0.8.5"
rand_chacha = "0.3.1"
regex = "1.8.4"
reqwest = { version = "0.11.18", features = ["json", "native-tls", "gzip", "multipart"] }
reqwest = { version = "0.12.2", features = ["json", "native-tls", "gzip", "multipart"] }
ring = "0.16.20"
roxmltree = "0.18.0"
rust_decimal = { version = "1.30.0", features = ["serde-with-float", "serde-with-str"] }
Expand Down
4 changes: 2 additions & 2 deletions crates/router/src/compatibility/stripe/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -639,8 +639,8 @@ impl From<errors::ApiErrorResponse> for StripeErrorCode {
}

impl actix_web::ResponseError for StripeErrorCode {
fn status_code(&self) -> reqwest::StatusCode {
use reqwest::StatusCode;
fn status_code(&self) -> actix_http::StatusCode {
use actix_http::StatusCode;

match self {
Self::Unauthorized => StatusCode::UNAUTHORIZED,
Expand Down
2 changes: 1 addition & 1 deletion crates/router/src/connector/paypal/transformers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2159,7 +2159,7 @@ impl TryFrom<&types::VerifyWebhookSourceRequestData> for PaypalSourceVerificatio
}

fn get_headers(
header: &actix_web::http::header::HeaderMap,
header: &reqwest::header::HeaderMap,
key: &'static str,
) -> CustomResult<String, errors::ConnectorError> {
let header_value = header
Expand Down
2 changes: 1 addition & 1 deletion crates/router/src/connector/square.rs
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ impl api::IncomingWebhook for Square {
) -> CustomResult<Vec<u8>, errors::ConnectorError> {
let header_value = request
.headers
.get(actix_web::http::header::HOST)
.get(reqwest::header::HOST)
.ok_or(errors::ConnectorError::WebhookSourceVerificationFailed)?;
let authority = header_value
.to_str()
Expand Down
2 changes: 1 addition & 1 deletion crates/router/src/connector/stripe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1907,7 +1907,7 @@ impl
}

fn get_signature_elements_from_header(
headers: &actix_web::http::header::HeaderMap,
headers: &reqwest::header::HeaderMap,
) -> CustomResult<HashMap<String, Vec<u8>>, errors::ConnectorError> {
let security_header = headers
.get("Stripe-Signature")
Expand Down
6 changes: 3 additions & 3 deletions crates/router/src/connector/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1189,20 +1189,20 @@ impl MandateReferenceData for api_models::payments::ConnectorMandateReferenceId

pub fn get_header_key_value<'a>(
key: &str,
headers: &'a actix_web::http::header::HeaderMap,
headers: &'a reqwest::header::HeaderMap,
) -> CustomResult<&'a str, errors::ConnectorError> {
get_header_field(headers.get(key))
}

pub fn get_http_header<'a>(
key: &str,
headers: &'a http::HeaderMap,
headers: &'a reqwest::header::HeaderMap,
) -> CustomResult<&'a str, errors::ConnectorError> {
get_header_field(headers.get(key))
}

fn get_header_field(
field: Option<&http::HeaderValue>,
field: Option<&reqwest::header::HeaderValue>,
) -> CustomResult<&str, errors::ConnectorError> {
field
.map(|header_value| {
Expand Down
2 changes: 1 addition & 1 deletion crates/router/src/connector/worldline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ impl ConnectorIntegration<api::RSync, types::RefundsData, types::RefundsResponse
}
}

fn is_endpoint_verification(headers: &actix_web::http::header::HeaderMap) -> bool {
fn is_endpoint_verification(headers: &reqwest::header::HeaderMap) -> bool {
headers
.get("x-gcs-webhooks-endpoint-verification")
.is_some()
Expand Down
26 changes: 25 additions & 1 deletion crates/router/src/core/webhooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1199,6 +1199,30 @@ pub async fn webhooks_wrapper<W: types::OutgoingWebhookType, Ctx: PaymentMethodR
Ok(application_response)
}

/*
This is a temporary fix for converting http::HeaderMap from actix_web to reqwest
Once actix_web upgrades the http version from v0.2.9 to 1.x, this can be removed
*/
fn convert_headers(
actix_headers: &actix_web::http::header::HeaderMap,
) -> Result<reqwest::header::HeaderMap, errors::ApiErrorResponse> {
let mut reqwest_headers = reqwest::header::HeaderMap::new();
for (name, value) in actix_headers.iter() {
let name_result = reqwest::header::HeaderName::from_str(name.as_str()).map_err(|err| {
logger::error!("Invalid Header Name: {}", err);
errors::ApiErrorResponse::InternalServerError
})?;
let value_result =
reqwest::header::HeaderValue::from_bytes(value.as_bytes()).map_err(|err| {
logger::error!("Invalid Header Value: {}", err);
errors::ApiErrorResponse::InternalServerError
})?;

reqwest_headers.insert(name_result, value_result);
}
Ok(reqwest_headers)
}

#[instrument(skip_all)]
pub async fn webhooks_core<W: types::OutgoingWebhookType, Ctx: PaymentMethodRetrieve>(
state: AppState,
Expand All @@ -1223,7 +1247,7 @@ pub async fn webhooks_core<W: types::OutgoingWebhookType, Ctx: PaymentMethodRetr
let mut request_details = api::IncomingWebhookRequestDetails {
method: req.method().clone(),
uri: req.uri().clone(),
headers: req.headers(),
headers: &convert_headers(req.headers())?,
query_params: req.query_string().to_string(),
body: &body,
};
Expand Down
15 changes: 8 additions & 7 deletions crates/router/src/services/api/client.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
use std::time::Duration;

use error_stack::ResultExt;
use http::{HeaderValue, Method};
use masking::PeekInterface;
use once_cell::sync::OnceCell;
use reqwest::multipart::Form;
use reqwest::{multipart::Form, Method};
use router_env::tracing_actix_web::RequestId;

use super::{request::Maskable, Request};
Expand Down Expand Up @@ -280,11 +279,13 @@ impl RequestBuilder for RouterRequestBuilder {

fn header(&mut self, key: String, value: Maskable<String>) -> CustomResult<(), ApiClientError> {
let header_value = match value {
Maskable::Masked(hvalue) => HeaderValue::from_str(hvalue.peek()).map(|mut h| {
h.set_sensitive(true);
h
}),
Maskable::Normal(hvalue) => HeaderValue::from_str(&hvalue),
Maskable::Masked(hvalue) => {
reqwest::header::HeaderValue::from_str(hvalue.peek()).map(|mut h| {
h.set_sensitive(true);
h
})
}
Maskable::Normal(hvalue) => reqwest::header::HeaderValue::from_str(&hvalue),
}
.change_context(ApiClientError::HeaderMapConstructionFailed)?;

Expand Down
4 changes: 2 additions & 2 deletions crates/router/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ pub enum Redirection {

#[derive(Debug, Clone)]
pub struct VerifyWebhookSourceRequestData {
pub webhook_headers: actix_web::http::header::HeaderMap,
pub webhook_headers: reqwest::header::HeaderMap,
pub webhook_body: Vec<u8>,
pub merchant_secret: api_models::webhooks::ConnectorWebhookSecrets,
}
Expand Down Expand Up @@ -1284,7 +1284,7 @@ pub struct ConnectorsList {

#[derive(Clone, Debug)]
pub struct Response {
pub headers: Option<http::HeaderMap>,
pub headers: Option<reqwest::header::HeaderMap>,
pub response: bytes::Bytes,
pub status_code: u16,
}
Expand Down
2 changes: 1 addition & 1 deletion crates/router/src/types/api/webhooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::{
pub struct IncomingWebhookRequestDetails<'a> {
pub method: actix_web::http::Method,
pub uri: actix_web::http::Uri,
pub headers: &'a actix_web::http::header::HeaderMap,
pub headers: &'a reqwest::header::HeaderMap,
pub body: &'a [u8],
pub query_params: String,
}
Expand Down
2 changes: 1 addition & 1 deletion crates/test_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ base64 = "0.21.2"
clap = { version = "4.3.2", default-features = false, features = ["std", "derive", "help", "usage"] }
rand = "0.8.5"
regex = "1.10.3"
reqwest = { version = "0.11.18", features = ["native-tls"] }
reqwest = { version = "0.12.2", features = ["native-tls"] }
serde = { version = "1.0.193", features = ["derive"] }
serde_json = "1.0.108"
serde_urlencoded = "0.7.1"
Expand Down
Loading