when i do some crude debugging in the `
http://pact_builder.rs`
``` pub fn push_interaction(&mut self, interaction: &dyn Interaction) -> &mut Self {
trace!("Adding interaction {:?}", interaction);
println!("current pact{:?}", self);
println!("adding interaction {:?}", interaction);
self.pact.add_interaction(interaction).unwrap();
println!("new pact{:?}", self);
self
}```
just to print what is happening with the pactbuilder. it looks like the interaction isn?t being saved
```current pactPactBuilder { pact: RequestResponsePact { consumer: Consumer { name: "test_two_interactions_consumer" }, provider: Provider { name: "test_two_interactions_provider" }, interactions: [], metadata: {"pactRust": {"consumer": "0.10.1", "models": "1.0.0"}, "pactSpecification": {"version": "3.0.0"}}, specification_version: V3 }, output_dir: None }
adding interaction RequestResponseInteraction { id: None, description: "looks for something that doesn't exist", provider_states: [], request: Request { method: "POST", path: "/", query: None, headers: Some({"Content-Type": ["application/json"]}), body: Present(b"{\"key\":\"i_dont_exist\"}", Some(ContentType { main_type: "application", sub_type: "json", attributes: {}, suffix: None }), None), matching_rules: MatchingRules { rules: {BODY: MatchingRuleCategory { name: BODY, rules: {DocPath { path_tokens: [Root], expr: "$" }: RuleList { rules: [Type], rule_logic: And, cascaded: false }} }, PATH: MatchingRuleCategory { name: PATH, rules: {} }, HEADER: MatchingRuleCategory { name: HEADER, rules: {} }} }, generators: Generators { categories: {} } }, response: Response { status: 200, headers: Some({"Content-Type": ["application/json"]}), body: Present(b"{\"count\":0,\"results\":[]}", Some(ContentType { main_type: "application", sub_type: "json", attributes: {}, suffix: None }), None), matching_rules: MatchingRules { rules: {HEADER: MatchingRuleCategory { name: HEADER, rules: {} }, BODY: MatchingRuleCategory { name: BODY, rules: {} }} }, generators: Generators { categories: {} } } }
new pactPactBuilder { pact: RequestResponsePact { consumer: Consumer { name: "test_two_interactions_consumer" }, provider: Provider { name: "test_two_interactions_provider" }, interactions: [RequestResponseInteraction { id: None, description: "looks for something that doesn't exist", provider_states: [], request: Request { method: "POST", path: "/", query: None, headers: Some({"Content-Type": ["application/json"]}), body: Present(b"{\"key\":\"i_dont_exist\"}", Some(ContentType { main_type: "application", sub_type: "json", attributes: {}, suffix: None }), None), matching_rules: MatchingRules { rules: {BODY: MatchingRuleCategory { name: BODY, rules: {DocPath { path_tokens: [Root], expr: "$" }: RuleList { rules: [Type], rule_logic: And, cascaded: false }} }, PATH: MatchingRuleCategory { name: PATH, rules: {} }, HEADER: MatchingRuleCategory { name: HEADER, rules: {} }} }, generators: Generators { categories: {} } }, response: Response { status: 200, headers: Some({"Content-Type": ["application/json"]}), body: Present(b"{\"count\":0,\"results\":[]}", Some(ContentType { main_type: "application", sub_type: "json", attributes: {}, suffix: None }), None), matching_rules: MatchingRules { rules: {HEADER: MatchingRuleCategory { name: HEADER, rules: {} }, BODY: MatchingRuleCategory { name: BODY, rules: {} }} }, generators: Generators { categories: {} } } }], metadata: {"pactRust": {"consumer": "0.10.1", "models": "1.0.0"}, "pactSpecification": {"version": "3.0.0"}}, specification_version: V3 }, output_dir: None }
current pactPactBuilder { pact: RequestResponsePact { consumer: Consumer { name: "test_two_interactions_consumer" }, provider: Provider { name: "test_two_interactions_provider" }, interactions: [], metadata: {"pactRust": {"consumer": "0.10.1", "models": "1.0.0"}, "pactSpecification": {"version": "3.0.0"}}, specification_version: V3 }, output_dir: None }
adding interaction RequestResponseInteraction { id: None, description: "looks for something that exists", provider_states: [], request: Request { method: "POST", path: "/", query: None, headers: Some({"Content-Type": ["application/json"]}), body: Present(b"{\"key\":\"i_exist\"}", Some(ContentType { main_type: "application", sub_type: "json", attributes: {}, suffix: None }), None), matching_rules: MatchingRules { rules: {BODY: MatchingRuleCategory { name: BODY, rules: {DocPath { path_tokens: [Root], expr: "$" }: RuleList { rules: [Type], rule_logic: And, cascaded: false }} }, PATH: MatchingRuleCategory { name: PATH, rules: {} }, HEADER: MatchingRuleCategory { name: HEADER, rules: {} }} }, generators: Generators { categories: {} } }, response: Response { status: 200, headers: Some({"Content-Type": ["application/json"]}), body: Present(b"{\"count\":1,\"results\":[\"i_exist\"]}", Some(ContentType { main_type: "application", sub_type: "json", attributes: {}, suffix: None }), None), matching_rules: MatchingRules { rules: {BODY: MatchingRuleCategory { name: BODY, rules: {} }, HEADER: MatchingRuleCategory { name: HEADER, rules: {} }} }, generators: Generators { categories: {} } } }
new pactPactBuilder { pact: RequestResponsePact { consumer: Consumer { name: "test_two_interactions_consumer" }, provider: Provider { name: "test_two_interactions_provider" }, interactions: [RequestResponseInteraction { id: None, description: "looks for something that exists", provider_states: [], request: Request { method: "POST", path: "/", query: None, headers: Some({"Content-Type": ["application/json"]}), body: Present(b"{\"key\":\"i_exist\"}", Some(ContentType { main_type: "application", sub_type: "json", attributes: {}, suffix: None }), None), matching_rules: MatchingRules { rules: {BODY: MatchingRuleCategory { name: BODY, rules: {DocPath { path_tokens: [Root], expr: "$" }: RuleList { rules: [Type], rule_logic: And, cascaded: false }} }, PATH: MatchingRuleCategory { name: PATH, rules: {} }, HEADER: MatchingRuleCategory { name: HEADER, rules: {} }} }, generators: Generators { categories: {} } }, response: Response { status: 200, headers: Some({"Content-Type": ["application/json"]}), body: Present(b"{\"count\":1,\"results\":[\"i_exist\"]}", Some(ContentType { main_type: "application", sub_type: "json", attributes: {}, suffix: None }), None), matching_rules: MatchingRules { rules: {BODY: MatchingRuleCategory { name: BODY, rules: {} }, HEADER: MatchingRuleCategory { name: HEADER, rules: {} }} }, generators: Generators { categories: {} } } }], metadata: {"pactRust": {"consumer": "0.10.1", "models": "1.0.0"}, "pactSpecification": {"version": "3.0.0"}}, specification_version: V3 }, output_dir: None }```