-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Cannot use bodyBase64 in response since #593 #863
Labels
Comments
Can you share the code (or example code) and/or mapping that causes this exception? |
Actually the problem occurs if I specify the ResponseTemplateTransformer globally: public class TestWireMock593 {
@Rule
public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort().extensions(new ResponseTemplateTransformer(true)));
@Before
public void setup() {
RestAssured.port = wireMockRule.port();
}
@Test
public void exampleTest() {
byte[] bodyBytes = given()
.when()
.get("/documents/document/123")
.then()
.statusCode(200)
.extract().response().body().asByteArray();
assertEquals(739L, bodyBytes.length);
}
} If the transformer is not global, then it's OK. |
The mapping was: {
"request": {
"method": "GET",
"urlPattern": "/documents/document/.+"
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/pdf"
},
//the base64 encoding of the content of /src/main/resources/wiremock/__files/minimal.pdf
//unfortunately we cannot use bodyFileName="" because of https://github.com/tomakehurst/wiremock/issues/247
"base64Body": "JVBERi0xLjEKJcKlwrHDqwoKMSAwIG9iagogIDw8IC9UeXBlIC9DYXRhbG9nCiAgICAgL1BhZ2VzIDIgMCBSCiAgPj4KZW5kb2JqCgoyIDAgb2JqCiAgPDwgL1R5cGUgL1BhZ2VzCiAgICAgL0tpZHMgWzMgMCBSXQogICAgIC9Db3VudCAxCiAgICAgL01lZGlhQm94IFswIDAgMzAwIDE0NF0KICA+PgplbmRvYmoKCjMgMCBvYmoKICA8PCAgL1R5cGUgL1BhZ2UKICAgICAgL1BhcmVudCAyIDAgUgogICAgICAvUmVzb3VyY2VzCiAgICAgICA8PCAvRm9udAogICAgICAgICAgIDw8IC9GMQogICAgICAgICAgICAgICA8PCAvVHlwZSAvRm9udAogICAgICAgICAgICAgICAgICAvU3VidHlwZSAvVHlwZTEKICAgICAgICAgICAgICAgICAgL0Jhc2VGb250IC9UaW1lcy1Sb21hbgogICAgICAgICAgICAgICA+PgogICAgICAgICAgID4+CiAgICAgICA+PgogICAgICAvQ29udGVudHMgNCAwIFIKICA+PgplbmRvYmoKCjQgMCBvYmoKICA8PCAvTGVuZ3RoIDU1ID4+CnN0cmVhbQogIEJUCiAgICAvRjEgMTggVGYKICAgIDAgMCBUZAogICAgKEhlbGxvIFdvcmxkKSBUagogIEVUCmVuZHN0cmVhbQplbmRvYmoKCnhyZWYKMCA1CjAwMDAwMDAwMDAgNjU1MzUgZiAKMDAwMDAwMDAxOCAwMDAwMCBuIAowMDAwMDAwMDc3IDAwMDAwIG4gCjAwMDAwMDAxNzggMDAwMDAgbiAKMDAwMDAwMDQ1NyAwMDAwMCBuIAp0cmFpbGVyCiAgPDwgIC9Sb290IDEgMCBSCiAgICAgIC9TaXplIDUKICA+PgpzdGFydHhyZWYKNTY1CiUlRU9GCg=="
}
} |
thanks!� |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since #593 (v2.5.1)
base64Body
cannot be used in the response: the exception is (with 2.14.0):it's OK with 2.5.0.
The text was updated successfully, but these errors were encountered: