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

Improve error message output #484

Open
mefellows opened this issue Nov 29, 2023 · 0 comments
Open

Improve error message output #484

mefellows opened this issue Nov 29, 2023 · 0 comments
Labels
feature request Indicates new feature requests

Comments

@mefellows
Copy link
Member

When there is a request mismatch in a consumer test, the error message is hidden away in the logs or in the response to the failing API test:

HTTP/1.1 500 Internal Server Error
access-control-allow-origin: *
content-type: application/json; charset=utf-8
x-pact: Request-Mismatch
content-length: 747
date: Tue, 28 Nov 2023 15:53:22 GMT

{"error":"Request-Mismatch : HttpRequest { method: \"POST\", path: \"/address\", query: None, headers: Some({\"content-length\": [\"192\"], \"host\": [\"localhost:9876\"], \"content-type\": [\"application/json; charset=utf-8\"]}), body: Present(b\"{\\\"Id\\\":\\\"3514466e-3e58-48b3-ab35-e553b91aa2b3\\\",\\\"AddressType\\\":\\\"delivery\\\",\\\"Street\\\":\\\"Main Street\\\",\\\"Number\\\":123,\\\"City\\\":\\\"Beverly Hills\\\",\\\"ZipCode\\\":90210,\\\"State\\\":\\\"California\\\",\\\"Country\\\":\\\"United States\\\"}\", Some(ContentType { main_type: \"application\", sub_type: \"json\", attributes: {\"charset\": \"utf-8\"}, suffix: None }), None), matching_rules: MatchingRules { rules: {} }, generators: Generators { categories: {} } }"}

Ideally, this is pretty printed and logged to console (or whatever logging framework is configured). For example, in Pact JS it would be something like this:

  Mock server failed with the following mismatches:

	0) The following request was incorrect:

            	POST /test

			 1.0 	$: Failed to parse the expected body as a MIME multipart body: 'no boundary in content-type'
@mefellows mefellows added the feature request Indicates new feature requests label Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Indicates new feature requests
Projects
None yet
Development

No branches or pull requests

1 participant