-
Notifications
You must be signed in to change notification settings - Fork 43
Not able to try body-transformer with simple stub #13
Comments
Hi @dotIN, Try to use responseTransformers instead of transformers. It might helps to solve your issue. |
@dotIN are you still having issues? |
Hi! How are you? I'm using the same versions that you provide on your Readme, and I tried to execute the same example that is present in the Readme and I have no success! This is the response that I have
I provide here the versions that I'm using to be more clear This is my mapping (present on the readme)
And I'm doing a POST request to /transform with body
I have that 500 as response. Thank you! |
@lthur looks like you don't have the required Try to download the com.jayway.jsonpath:json-path jar, which includes the net.minidev package, and include it into your classpath when you run the |
@lthur I've just upgraded body transformer to version 1.1.3 to use the newest wiremock version - 2.3.1. Give it a try and let me know if you're still running into problems. |
Hi,
Created a simple stub in mappings folder , copied from one of the examples you provided, used the below Command to start & on startup see the below error.
NOTE : Java version 1.8, I am using wiremock-body-transformer-1.0.4 since I had trouble using the latest version.
{
"request": {
"method": "GET",
"url": "/local-transform"
},
"response": {
"status": 200,
"body": "{"name": "$(var)"}",
"transformers": ["body-transformer"]
}
}
java -cp "wiremock-body-transformer-1.0.4.jar;wiremock-1.57-standalone.jar" com.github.tomakehurst.wiremock.standalone.WireMockServerRunner --verbose --extensions com.opentable.extension.BodyTransformer --port 9999
ERROR
2016-05-11 16:30:18.492 Verbose logging enabled
Exception in thread "main" java.lang.RuntimeException: Unable to bind JSON to object. Reason: Unrecognized field "transformers" (class com.github.tomakehurst.wiremock.http.ResponseDefinition), not mar
ked as ignorable (11 known properties: "fixedDelayMilliseconds", "body", "fault", "headers", "bodyFileName", "proxyBaseUrl", "base64Body", "status", "responseTransformers", "additionalProxyRequestHead
ers", "originalRequest" [truncated]])
at [Source: {
"request": {
"method": "GET",
"url": "/local-transform"
},
"response": {
"status": 200,
"body": "{"name": "$(var)"}",
"transformers": ["body-transformer"]
}
}; line: 9, column: 26](through reference chain: com.github.tomakehurst.wiremock.stubbing.StubMapping["response"]->com.github.tomakehurst.wiremock.http.ResponseDefinition["transformers"]) JSON:{
"request": {
"method": "GET",
"url": "/local-transform"
},
"response": {
"status": 200,
"body": "{"name": "$(var)"}",
"transformers": ["body-transformer"]
}
}
at com.github.tomakehurst.wiremock.common.Json.read(Json.java:33)
at com.github.tomakehurst.wiremock.stubbing.StubMapping.buildFrom(StubMapping.java:56)
at com.github.tomakehurst.wiremock.stubbing.JsonStubMappingCreator.addMappingFrom(JsonStubMappingCreator.java:28)
at com.github.tomakehurst.wiremock.standalone.JsonFileMappingsLoader.loadMappingsInto(JsonFileMappingsLoader.java:39)
at com.github.tomakehurst.wiremock.core.WireMockApp.loadMappingsUsing(WireMockApp.java:87)
at com.github.tomakehurst.wiremock.core.WireMockApp.loadDefaultMappings(WireMockApp.java:83)
at com.github.tomakehurst.wiremock.core.WireMockApp.(WireMockApp.java:75)
at com.github.tomakehurst.wiremock.WireMockServer.(WireMockServer.java:78)
at com.github.tomakehurst.wiremock.standalone.WireMockServerRunner.run(WireMockServerRunner.java:62)
at com.github.tomakehurst.wiremock.standalone.WireMockServerRunner.main(WireMockServerRunner.java:108)
Caused by: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "transformers" (class com.github.tomakehurst.wiremock.http.ResponseDefinition), not marked as ignorable
(11 known properties: "fixedDelayMilliseconds", "body", "fault", "headers", "bodyFileName", "proxyBaseUrl", "base64Body", "status", "responseTransformers", "additionalProxyRequestHeaders", "originalRe
quest" [truncated]])
at [Source: {
"request": {
"method": "GET",
"url": "/local-transform"
},
"response": {
"status": 200,
"body": "{"name": "$(var)"}",
"transformers": ["body-transformer"]
}
}; line: 9, column: 26](through reference chain: com.github.tomakehurst.wiremock.stubbing.StubMapping["response"]->com.github.tomakehurst.wiremock.http.ResponseDefinition["transformers"])
at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:51)
at com.fasterxml.jackson.databind.DeserializationContext.reportUnknownProperty(DeserializationContext.java:744)
at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:915)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1306)
at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1284)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:243)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:118)
at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:538)
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:99)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:238)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:118)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3066)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2161)
at com.github.tomakehurst.wiremock.common.Json.read(Json.java:31)
... 9 more
The text was updated successfully, but these errors were encountered: