Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print response body when any error response received during any interaction with the Pact Broker #1092

Open
bethesque opened this issue May 16, 2020 · 5 comments

Comments

@bethesque
Copy link
Member

If there's a single/small number of points to put this code so that it worked for all calls, that would be great. One can dream...

If there is not, there are two main use cases that crop up frequently that it would be great to cover.

Print the body when there is a 401 response received from Pactflow. There is text in the error response that helps users with incorrectly configured credentials to fix their configuration (eg. a lot of people try to connect using basic auth instead of their API token. The response body indicates this.) The most common place this happens is during pact publication, because that's the first thing people try to do.

The other main use case is the error response received when publishing verification results. It's possible this output was added in a later version of the code, but people are still using old versions, so if this is already added, then ignore this bit!

@Hazz223
Copy link
Contributor

Hazz223 commented May 17, 2020

Hi,
I've been looking into this error, and I think I know how to change to code somewhat to enable this.
However, I've been testing PactFlow with the PUT endpoint for publishing pacts, and found that it doesn't seem to return a body, only a status code of 401. I've tried it with the Read only token, and an invalid token. Should there be a body? I wonder if I'm missing something obvious. If i am, sorry about that!

Also, I've noticed in the Pact JVM Docs that there isn't a reference to PactFlow, and wondered if it was worth also linking to the PactFlow docs here too? Just a suggestion.

Thanks!

@bethesque
Copy link
Member Author

Try using a username and password instead of a bearer token, and you'll get a response body. On the weekend I did a change to add an error message for general 401s - I'll release it today.

@bethesque
Copy link
Member Author

And yes, we should put in a link to pactflow. This is the link we'd want https://docs.pactflow.io/docs/getting-started/#configuring-your-api-token

@Hazz223
Copy link
Contributor

Hazz223 commented May 22, 2020

Ah awesome! I'll get some time this weekend to try and integrate it / raise the pull requests.

@Javalencanta
Copy link

hi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants