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

Pact file is not parsed correct starting with version 4.1.2 when using XML requests in body #1218

Closed
anddreiu opened this issue Oct 1, 2020 · 2 comments
Labels
bug Indicates an unexpected problem or unintended behavior

Comments

@anddreiu
Copy link

anddreiu commented Oct 1, 2020

After upgrading the pact provider junit library from 4.1.1 to 4.1.2 there are some issues when running the provider tests because the Pact file is not parsed.

au.com.dius.pact.core.support.json.JsonException: Invalid JSON (1:2), found unexpected character '<'
	at au.com.dius.pact.core.support.json.JsonLexer.unexpectedCharacter(JsonParser.kt:88)
	at au.com.dius.pact.core.support.json.JsonLexer.nextToken(JsonParser.kt:79)
	at au.com.dius.pact.core.support.json.JsonParser.nextTokenOrThrow(JsonParser.kt:278)
	at au.com.dius.pact.core.support.json.JsonParser.parse(JsonParser.kt:151)
	at au.com.dius.pact.core.support.json.JsonParser.parseString(JsonParser.kt:131)
	at au.com.dius.pact.core.model.RequestResponseInteraction$Companion.setupBodyForJson(RequestResponseInteraction.kt:123)
	at au.com.dius.pact.core.model.RequestResponseInteraction$Companion.requestToMap(RequestResponseInteraction.kt:85)
	at au.com.dius.pact.core.model.RequestResponseInteraction.toMap(RequestResponseInteraction.kt:37)
	at au.com.dius.pact.provider.reporters.JsonReporter.interactionDescription(JsonReporter.kt:132)
	at au.com.dius.pact.provider.ProviderVerifier.reportInteractionDescription(ProviderVerifier.kt:502)
	at au.com.dius.pact.provider.junit.InteractionRunner.interactionBlock(InteractionRunner.kt:218)
	at au.com.dius.pact.provider.junit.InteractionRunner.run(InteractionRunner.kt:162)
	at au.com.dius.pact.provider.junit.PactRunner.runChild(PactRunner.kt:150)
	at au.com.dius.pact.provider.junit.PactRunner.runChild(PactRunner.kt:56)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)

I've noticed that the problem appears when the Content-type for the interaction request is not specified:

"headers": {
        "Content-Type": "text/xml"
}

With the previous versions it was not mandatory to add this.

Thanks,
Andrei

@uglyog uglyog added the bug Indicates an unexpected problem or unintended behavior label Oct 17, 2020
@uglyog
Copy link
Member

uglyog commented Oct 18, 2020

4.1.9 released with the fix

@anddreiu
Copy link
Author

I can confirm that the issue is fixed in 4.1.9 version. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants