Open vbutlerovskyi opened 7 months ago
You're mixing versions, that may be causing the issue
testImplementation("au.com.dius.pact.provider:junit5spring:4.6.8")
testImplementation "au.com.dius.pact.consumer:groovy:4.3.19"
Hey @rholshausen, thanks for turnaround. Do you suggest to use either 4.6.8 or 4.3.19 in both places?
Yes, I would recommend 4.6.8 as 4.3.x is not maintained anymore.
Thanks again, I will try and write down my findings here
Hey @rholshausen, I tried what you suggested but unfortunately nothing changed... Do you end up having any other ideas? Thank you in advance for your time
The service provider is your service not the pact broker, so this is wrong (but not what is causing the issue)
serviceProvider.protocol = 'https'
serviceProvider.host = 'https://pact-broker.com'
serviceProvider.port = 443
serviceProvider.path = '/pacts/my_pact'
serviceProvider.insecure = true
Ah! this should be lower case Authorization:
Thanks for the hint, but unfortunately nothing changed... I tried:
serviceProvider.hasPactsFromPactBroker('https://pact-broker.com', authorization: ['Bearer', 'bSwVWhZbdQ7EI9M6PwCp3Olx1DQ'])
serviceProvider.hasPactsFromPactBroker('https://pact-broker.com', authorization: ['Basic', 'bSwVWhZbdQ7EI9M6PwCp3Olx1DQ'])
Hi there,
I'm a beginner in PACT testing and I was given a challenge to have one up and running so I accepted it, albeit it's not going smoothly. Basically I'm trying to validate the JSON contract from our running broker between two of our services using hasPactsFromPactBroker() and it keeps giving me 401 no matter what.
I tried something like this:
As a result, I keep getting 401 Unauthorized:
I also tried another way using username and password plus specifying the path attribute deliberately:
And then the error looks slightly different yet the same:
I'm using these versions of dependencies in my build.gradle:
It's worth mentioning that the very first version of request works well in Postman, here's the cURL:
I believe I tried everything possible so any hint would be really appreciated!
Thanks in advance!