From fe62b1fe2137de456a6a0e8e315fd0592c29577d Mon Sep 17 00:00:00 2001 From: Mrudul Vajpayee <124863642+mrudulvajpayee4935@users.noreply.github.com> Date: Mon, 14 Oct 2024 18:44:36 +0530 Subject: [PATCH] refactor: add user agent header in outgoing webhooks (#6289) Co-authored-by: Mrudul Vajpayee --- crates/router/src/core/webhooks/outgoing.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/crates/router/src/core/webhooks/outgoing.rs b/crates/router/src/core/webhooks/outgoing.rs index aa2aae928c..fbf6927835 100644 --- a/crates/router/src/core/webhooks/outgoing.rs +++ b/crates/router/src/core/webhooks/outgoing.rs @@ -13,6 +13,7 @@ use common_utils::{ use diesel_models::process_tracker::business_status; use error_stack::{report, ResultExt}; use hyperswitch_domain_models::type_encryption::{crypto_operation, CryptoOperation}; +use hyperswitch_interfaces::consts; use masking::{ExposeInterface, Mask, PeekInterface, Secret}; use router_env::{ instrument, @@ -606,10 +607,16 @@ pub(crate) fn get_outgoing_webhook_request( outgoing_webhook: api::OutgoingWebhook, business_profile: &domain::Profile, ) -> CustomResult { - let mut headers = vec![( - reqwest::header::CONTENT_TYPE.to_string(), - mime::APPLICATION_JSON.essence_str().into(), - )]; + let mut headers = vec![ + ( + reqwest::header::CONTENT_TYPE.to_string(), + mime::APPLICATION_JSON.essence_str().into(), + ), + ( + reqwest::header::USER_AGENT.to_string(), + consts::USER_AGENT.to_string().into(), + ), + ]; let transformed_outgoing_webhook = WebhookType::from(outgoing_webhook); let payment_response_hash_key = business_profile.payment_response_hash_key.clone();