From 85eb7eb850fde656e5b28c2e98c0c5d2435e767d Mon Sep 17 00:00:00 2001 From: Ronald Holshausen Date: Fri, 13 Dec 2024 09:41:55 +1100 Subject: [PATCH] fix: Pass the transport config to the plugin in the test context under the transport_config key --- pact_mock_server/src/server_manager.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pact_mock_server/src/server_manager.rs b/pact_mock_server/src/server_manager.rs index e8b42321c..fc4aada3f 100644 --- a/pact_mock_server/src/server_manager.rs +++ b/pact_mock_server/src/server_manager.rs @@ -18,6 +18,7 @@ use pact_models::pact::Pact; #[cfg(feature = "plugins")] use pact_plugin_driver::mock_server::MockServerDetails; #[cfg(feature = "tls")] use rustls::ServerConfig; #[cfg(not(feature = "plugins"))] use serde::{Deserialize, Serialize}; +use serde_json::Value; use tracing::{debug, error, trace}; #[cfg(feature = "plugins")] use url::Url; @@ -210,10 +211,15 @@ impl ServerManager { port: addr.port() as u32, tls: false }; - let test_context = hashmap! {}; + let test_context = hashmap! { + "transport_config".to_string() => Value::Object(config.transport_config + .iter() + .map(|(k, v)| (k.clone(), v.clone())) + .collect()) + }; let result = self.runtime.block_on( pact_plugin_driver::plugin_manager::start_mock_server_v2(transport, v4_pact.boxed(), - mock_server_config, test_context) + mock_server_config, test_context) )?; self.mock_servers.insert( id,