Skip to content

Commit

Permalink
Merge branch 'main' of github.com:juspay/hyperswitch into health_checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Chethan-rao committed Jan 3, 2024
2 parents 0cdfb9d + 46e84a6 commit 9bc8ce6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
3 changes: 2 additions & 1 deletion crates/router/src/db/health_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use router_env::logger;
use super::{MockDb, StorageInterface, Store};
use crate::{
connection,
consts::LOCKER_HEALTH_CALL_PATH,
core::errors::{self, CustomResult},
routes,
services::api as services,
Expand Down Expand Up @@ -110,7 +111,7 @@ impl HealthCheckInterface for Store {
let locker = &state.conf.locker;
if !locker.mock_locker {
let mut url = locker.host_rs.to_owned();
url.push_str("/health");
url.push_str(LOCKER_HEALTH_CALL_PATH);
let request = services::Request::new(services::Method::Get, &url);
services::call_connector_api(state, request)
.await
Expand Down
7 changes: 6 additions & 1 deletion crates/router/src/middleware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,21 @@ where
actix_web::dev::forward_ready!(service);

fn call(&self, req: actix_web::dev::ServiceRequest) -> Self::Future {
let old_x_request_id = req.headers().get("x-request-id").cloned();
let mut req = req;
let request_id_fut = req.extract::<router_env::tracing_actix_web::RequestId>();
let response_fut = self.service.call(req);

Box::pin(async move {
let request_id = request_id_fut.await?;
let request_id = request_id.as_hyphenated().to_string();
if let Some(upstream_request_id) = old_x_request_id {
router_env::logger::info!(?request_id, ?upstream_request_id);
}
let mut response = response_fut.await?;
response.headers_mut().append(
http::header::HeaderName::from_static("x-request-id"),
http::HeaderValue::from_str(&request_id.as_hyphenated().to_string())?,
http::HeaderValue::from_str(&request_id)?,
);

Ok(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,25 @@
"payment_method_types": [
{
"payment_method_type": "credit",
"card_networks": [
"Visa",
"Mastercard"
],
"card_networks": ["AmericanExpress",
"Discover",
"Interac",
"JCB",
"Mastercard",
"Visa", "DinersClub","UnionPay","RuPay"],
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
"installment_payment_enabled": true
},
{
"payment_method_type": "debit",
"card_networks": [
"Visa",
"Mastercard"
],
"card_networks": ["AmericanExpress",
"Discover",
"Interac",
"JCB",
"Mastercard",
"Visa", "DinersClub","UnionPay","RuPay"],
"minimum_amount": 1,
"maximum_amount": 68607706,
"recurring_enabled": true,
Expand Down

0 comments on commit 9bc8ce6

Please sign in to comment.