Hi running beta58 and trying to debug a consumer c...
# pact-js
a
Hi running beta58 and trying to debug a consumer contract test where the URL path is matching when it shouldn't be
Copy code
[2022-07-27T08:00:39Z INFO  pact_mock_server::hyper_server] Received request HTTP Request ( method: GET, path: /foo/1/bar, query: None, headers: Some({"accept": ["application/json"], "authorization": ["Bearer undefined"], "user-agent": ["node-fetch/1.0 (+<https://github.com/bitinn/node-fetch>)"], "accept-encoding": ["gzip", "deflate"], "connection": ["close"], "host": ["127.0.0.1:52198"]}), body: Empty )

[2022-07-27T08:00:39Z INFO  pact_matching] comparing to expected HTTP Request ( method: GET, path: /fooBlah/1/bar, query: None, headers: Some({"Accept": ["application/json"]}), body: Missing )
[2022-07-27T08:00:39Z INFO  pact_mock_server::hyper_server] Request matched, sending response HTTP Response ( status: 200, headers: Some({"Content-Type": ["application/json"]}), body: Present(266 bytes, application/json) )
I'm looking for strings like
comparing to expected HTTP Request
in the pact and pact-core codebase but not having any luck - could someone point me at where these are? [Some GLIBC-related blockers prevent me moving to beta62 at this time]
m
Just dropped off for the day, but the core matching is all in here: https://github.com/pact-foundation/pact-reference/tree/master/rust
🐉
a
Thanks @Matt (pactflow.io / pact-js / pact-go)!
👍 1
I'm a bit stuck as no idea how to debug Rust code when running Webstorm on a nodejs project, but I can see that it will end up in the
match_path()
function and do this:
Copy code
match_values(&path, &context.select_best_matcher(&path), expected.to_string(), actual.to_string())
All I can guess is that this works as expected unless the
fromProviderState
matcher was used on the path; maybe something to do with the
select_best_matcher
function?
m
Interesting. My assumption is that the path should match exactly (on the consumer side), as I didn’t think it was a matcher
@uglyog any thoughts? The request is going to
/foo/1/bar
but the
fromProviderState
matcher is configured as fromProviderState(‘/fooBlah/{id}/bar’, ‘/fooBlah/1/bar’)