Anyone any ideas on printing out response after th...
# pact-go
w
Anyone any ideas on printing out response after the verifier has run? Currently getting a 422 back from our provider, and the logs that are getting printed are super verbose and i’m not sure what’s meant to be what. Can I just stick something in an afterEach hook? And if so, how do I access the response?
m
hmmm I don’t think we provide access to the request/response cycle. We could potentially expose that though, as it’s just standard HTTP middleware
If you wanted to share the logs, I can see if I can help, and also improve the logging
😆 1
w
Thanks Matt, I think it’s actually okay though, gonna leave it to my devs to figure out what the actual issue is. But yeah if I’m the first person asking, probably isn’t that much of a requirement. If anything it just suggests I’m too lazy to actually setup the service locally to figure it out 😁
m
haha no probs
w
Actually Matt, so briefly, all our services are deployed in k8s. Some of the services have dependant services that means it’s difficult to just spin up a service by itself to test against. So we’re currently thinking that the way we’d want to use pact is… • On PR, have a github action that deploys the branched version of the service into our dev env • Run the Pact tests against it • Redeploy the main branch back into dev env But in this scenario, if we get a 422 response back for a test that was expecting a 201, all we really get back in the error messaging from Pact is that the body doesn’t match, and that the status doesn’t match, but doesn’t return back anything we got from the error response, so makes it a bit more difficult to figure out any errors without trying to dive into logs/traces etc. Ideally, I’d love to be able to also print out the response body on error, so we can glean more info from the Pact test itself. Is there any way to handle this currently in Pact, or does it look like it would be a feature request of some kind? And if so, do I just need to raise that on Github?
Also sorry for the ping @Matt (pactflow.io / pact-js / pact-go), our hours are really out of sync with us being on almost opposite sides of the world 😅, but if there’s any chance you’d have any suggestions or thoughts for the above, I’d really appreciate it 🙂
m
My apologies, I did totally miss this (we had a number of workshops last week so was a bit flat out)
Is there any way to handle this currently in Pact, or does it look like it would be a feature request of some kind? And if so, do I just need to raise that on Github?
yes please, a feature request on GitHub would be great, and we’ll see if we can find a way
w
Nice, thanks Matt, will raise one
👍 1