mirror of
				https://github.com/juspay/hyperswitch.git
				synced 2025-11-01 02:57:02 +08:00 
			
		
		
		
	fix(core): do not construct request if it is already available (#3826)
This commit is contained in:
		| @ -338,30 +338,31 @@ where | ||||
|                 ], | ||||
|             ); | ||||
|  | ||||
|             let connector_request = connector_request.or(connector_integration | ||||
|                 .build_request(req, &state.conf.connectors) | ||||
|                 .map_err(|error| { | ||||
|                     if matches!( | ||||
|                         error.current_context(), | ||||
|                         &errors::ConnectorError::RequestEncodingFailed | ||||
|                             | &errors::ConnectorError::RequestEncodingFailedWithReason(_) | ||||
|                     ) { | ||||
|                         metrics::REQUEST_BUILD_FAILURE.add( | ||||
|                             &metrics::CONTEXT, | ||||
|                             1, | ||||
|                             &[metrics::request::add_attributes( | ||||
|                                 "connector", | ||||
|                                 req.connector.to_string(), | ||||
|                             )], | ||||
|                         ) | ||||
|                     } | ||||
|                     error | ||||
|                 })?); | ||||
|             let connector_request = match connector_request { | ||||
|                 Some(connector_request) => Some(connector_request), | ||||
|                 None => connector_integration | ||||
|                     .build_request(req, &state.conf.connectors) | ||||
|                     .map_err(|error| { | ||||
|                         if matches!( | ||||
|                             error.current_context(), | ||||
|                             &errors::ConnectorError::RequestEncodingFailed | ||||
|                                 | &errors::ConnectorError::RequestEncodingFailedWithReason(_) | ||||
|                         ) { | ||||
|                             metrics::REQUEST_BUILD_FAILURE.add( | ||||
|                                 &metrics::CONTEXT, | ||||
|                                 1, | ||||
|                                 &[metrics::request::add_attributes( | ||||
|                                     "connector", | ||||
|                                     req.connector.to_string(), | ||||
|                                 )], | ||||
|                             ) | ||||
|                         } | ||||
|                         error | ||||
|                     })?, | ||||
|             }; | ||||
|  | ||||
|             match connector_request { | ||||
|                 Some(request) => { | ||||
|                     logger::debug!(connector_request=?request); | ||||
|  | ||||
|                     let masked_request_body = match &request.body { | ||||
|                         Some(request) => match request { | ||||
|                             RequestContent::Json(i) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Narayan Bhat
					Narayan Bhat