Marko (IttyBittyApps / pact-swift)
01/28/2025, 3:49 AMRefCell {
value: PactHandleInner {
pact: V4Pact {
consumer: Consumer { name: "Consumer" },
provider: Provider { name: "Provider" },
interactions: [
SynchronousHttp {
id: None,
key: None,
description: "a request for a known path with a body matching number",
provider_states: [],
request: HttpRequest {
method: "POST",
path: "/jsonbody",
query: None,
headers: Some({"Content-Type": ["application/json"]}),
body: Present(
b"{\"key1\":123.1,\"key2\":321}",
Some(ContentType { main_type: "application", sub_type: "json", attributes: {}, suffix: None }), None
),
matching_rules: MatchingRules { rules: {
PATH: MatchingRuleCategory { name: PATH, rules: {} },
BODY: MatchingRuleCategory { name: BODY, rules: {
DocPath {
path_tokens: [Root, Field("key2")], expr: "$.key2"
}: RuleList {
rules: [Number],
rule_logic: And,
cascaded: false
},
DocPath {
path_tokens: [Root, Field("key1")], expr: "$.key1"
}: RuleList {
rules: [Number],
rule_logic: And,
cascaded: false
},
DocPath { path_tokens: [Root], expr: "$" }: RuleList { rules: [Type], rule_logic: And, cascaded: false }} }}
},
generators: Generators { categories: {} } },
response: HttpResponse { status: 200, headers: None, body: Missing, matching_rules: MatchingRules { rules: {} }, generators: Generators { categories: {} } }, comments: {}, pending: false, plugin_config: {}, interaction_markup: InteractionMarkup { markup: "", markup_type: "" }, transport: None }],
metadata: {
"namespace1": Object {"name1": String("value1")},
"namespace2": Object {"name2": String("value2")},
"pactRust": Object {"ffi": String("0.4.25")}},
plugin_data: []
},
mock_server_started: true,
specification_version: V4
}
}
Request sending string values instead of expected numbers:
POST /jsonbody
body: {"key1": "321.1", "key2": "456"}
2025-01-28T03:42:33.886570Z INFO tokio-runtime-worker pact_mock_server::hyper_server: Request matched, sending response
2025-01-28T03:42:33.886572Z DEBUG tokio-runtime-worker pact_mock_server::hyper_server:
----------------------------------------------------------------------------------------
status: 200
headers: None
body: Missing
----------------------------------------------------------------------------------------
Should have failed, right?
I mean, matcher said "numeric" value, I sent "string". Something ain't right here.