-
-
Notifications
You must be signed in to change notification settings - Fork 481
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
Response body as bytearray #600
Comments
There is no way to compare a binary file apart from byte array equality. How do you expect the binary content to be verified? |
in that case I wouldn't expect any content verification, I will be ok with the fact that the body is a binary there's a way to do it? |
It will need to include an update to the DSL to add a method to accept a byte array, then the body data will need to be stored as a byte array and converted appropriately when used. We will also have to add a matcher that returns success if the body is not empty. What is the content type? If it is |
Hi, we ran into the same problem. application/octet-stream should work for us. Our use case doesn't require verification of the content because producer is a pass-through although I don't see why comparing through byte array equality shouldn't be an option. |
In my case, I would like to test a method returning a byte array. I also don't like methods returning byte arrays as the comparison of a json response would be much better. Now I have to live with it. The possibility to use at least the byte array equality would make my life less painful :) |
Hi, we'd like to verify a byte stream as well.
Maybe by us implementing some custom verification? Besides the String ones, I can see that there are 2 more variants of override fun body(dslPart: DslPart): HttpResponseBuilder
override fun body(builder: BodyBuilder): HttpResponseBuilder How do these work, how can I use them? I tried to find documentation, but couldn't find any. |
This is an old issue and the comment is no longer valid. Current versions of Pact-JVM store body content internally as byte arrays, converting it as appropriate. There is a method pact-jvm/consumer/junit/src/test/groovy/au/com/dius/pact/consumer/junit/BinaryFileSpec.groovy Line 27 in 1b00f63
As to the question on the other methods above:
|
Did some digging because I couldn't find that method, and I noticed that we're using Which one is recommended? I found the following pieces of code that seem to suggest that Line 15 in 2b2055f
pact-jvm/consumer/src/main/kotlin/au/com/dius/pact/consumer/dsl/PactBuilder.kt Lines 78 to 83 in 2b2055f
|
Hi, we're trying to introduce pact in our CI, but we've come to a standstill...
There's an api that returns binary file, I'm defining the RequestResponsePath in the consumer, but there's no method with sign
body(byte[] content)
.String is not enough because reading a binary into stream transform it in a text content.
Does a workaround on this exist?
thanks
The text was updated successfully, but these errors were encountered: