Brandon Trautmann
09/08/2023, 6:20 PMnitin kumar
09/10/2023, 6:58 AM_findAll_(RequestPatternBuilder._newRequestPattern_().withUrl("/v2/pusher/user"));
{
"errors": [
{
"code": 10,
"source": {
"pointer": "/timestamp"
},
"title": "Error parsing JSON",
"detail": "Unrecognized field \"timestamp\" (class com.github.tomakehurst.wiremock.common.Errors), not marked as ignorable"
}
]
}
I am getting this when calling static method to query wiremock server
version using: 2.35.1
but works fine when doing,
wiremock.find(RequestPatternBuilder._newRequestPattern_().withUrl("/v2/pusher/user"))
Can someone please help ?Alan Guitard
09/11/2023, 10:35 AMResponseTemplateTransformer
🙂
Here is what I implemented before:
new ResponseTemplateTransformer(true, DateTemplate.NAME, dateTemplate)
The DateTemplate
being a private class implementing the Helper<T>
.
I guess now I have to implement TemplateModelDataProviderExtension
but I can't find any documentation on how to properly use it. Is its output Map<String, Object>
is a map of helpers ? Should I just register TemplateModelDataProviderExtension
like any other extensions through Options
?
Thank you very much for the help, don't hesitate to ask precision !Julien
09/11/2023, 4:47 PMResponseDefinitionBuilder.like(serveEvent.getResponseDefinition())
.withBody(mapper.writeValueAsBytes(customResponseObject))
.build()
I'm trying to include data generated via a Helper class. I've been testing my code with Wiremock's trim
{{trim request.headers.User-Agent}}
If that string is included in the template file, it is processed and replaced.
If that string is included in in object included via withBody, it is no processed.
Are helpers disabled when a ResponseDefinitionTransformerV2 is used ? Should I avoid using them both at the same time ? Is there anyway to debug that situation (some log level, Wiremock class looping through all extensions, for example) ?
Feel free to ask for any precision, and thank you for any answer you can provide.Bhavin Modi
09/11/2023, 6:44 PMEkta Bansal
09/12/2023, 9:53 AMKrupa Mashruwala
09/12/2023, 12:59 PMCarlos Villar
09/12/2023, 2:53 PM{
"request": {
"method": "POST",
"url": "/api/endpoint"
},
"response": {
"status": 200,
"transformers": [
"response-template"
],
"bodyFileName": "response.json",
"headers": {
"Content-Type": "application/json"
}
}
}
response.json
{
"message": "Hello, {{request.body.message}}!",
"status": 200
}
I need this response:
{
"message": "Hello, Carlos!",
"status": 200
}
but I get this:
{
"message": "Hello, {{request.body.message}}!",
"status": 200
}
request body:
{
"message": "Carlos"
}
What's wrong? Is it possible?
wiremock standalone 3.0.1
java -jar wiremock-standalone-3.0.1.jar --port 8282 --verbose
Linux server
Thanks a lot!!Chetan
09/13/2023, 5:06 AMjaspal singh
09/13/2023, 4:26 PMOleg Nenashev
09/13/2023, 4:51 PMHari Krishnan
09/14/2023, 6:55 AMEkta Bansal
09/14/2023, 7:44 AMGaurav Kumar
09/14/2023, 6:37 PMGaurav Kumar
09/14/2023, 6:38 PMKelly Goedert
09/14/2023, 10:03 PMBrian
09/15/2023, 2:14 PMHari Krishnan
09/18/2023, 2:53 AMjava -cp default-response.jar:wiremock-standalone-3.0.0.jar \wiremock.Run
—`extensions org.xyz.abcTransformer,org.xyz.defTransformer`
Also, I cannot get —local-response-templating to work along with the above commandNadia Debogori
09/18/2023, 10:06 AMRUN mkdir ./extensions
RUN wget -O ./extensions/wiremock-state-extension-standalone-0.1.0.jar {{url}}
to Dockerfile. But I understand now that i have no idea how to get this url and can i do it at all). So the question is: how can i download extension?Simon Bruce
09/18/2023, 9:34 PMAnzar Ahsan
09/19/2023, 1:16 AM{
"name": "email_happypath",
"request": {
"method": "POST",
"url": "/send/email",
"bodyPatterns": [
{
"matchesJsonPath": "$.phone",
"matches": "^5\\d[9]$"
}
]
},
"response": {
"status": 200,
"headers": {
"Content-Type": "application/json"
},
"bodyFileName": "email_happypath.json",
"transformers" : ["response-template"]
}
}Jamie Tanna [he/him]
09/19/2023, 3:19 PMShehryar Ahmed
09/19/2023, 4:52 PMStubRequestFilter
CustomFilter and i want to run my wiremock container with this extension. how should i run this?
i tried following https://github.com/wiremock/wiremock/tree/master/test-extension
by putting the classpath of my filter in resources/extensions and running
.withCommand(
"--extensions CustomFilter --global-response-templating --verbose --port " + WIREMOCK_PORT)
.withFileSystemBind("./src/test/resources/extensions", "/var/wiremock/extensions", BindMode.READ_WRITE)
, but had no luckGarik Hakobyan
09/20/2023, 2:11 PMCaused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mockDataDirectorManagementClient' defined in com.unisoftwareplus.devicemanagementgateway.mockserver.WireMockConfig: Invocation of init method failed; nested exception is com.github.tomakehurst.wiremock.common.FatalStartupException: java.lang.RuntimeException: java.io.IOException: Failed to bind to /0.0.0.0:9561
how is it possible to set up dynamic port.
using the below dependency
testImplementation 'org.wiremock:wiremock-standalone:3.0.4'
jaspal singh
09/21/2023, 4:30 PMRahul Agrawal
09/22/2023, 7:57 AM"request" : {
"url" : "/some/operation1",
"method" : "POST"
},
"response" : {
"status" : 200,
"bodyFileName" : "wsdl/2019-12-21_WEP.xml",
"headers" : {
"Content-Type" : "text/xml"
},
"transformers" : [ "response-template" ]
}
Now the need is to extract some xpath values from the in coming soap request body and replace/substitute them in the hard code soap responses at runtime.
Using the soapXPath helpers mentioned in the section https://wiremock.org/docs/response-templating/#xpath-helpers of the documentation,
extraction of the value can be done.
However we are unable to find how to insert those into the soap response .
---we want to dynamically replace certain parts of the hard coded soap response that is in the file wsdl/2019-12-21_WEP.xml
What are the possible ways to do this using wiremock.
Thanks in advance.Abhijeet
09/22/2023, 2:56 PMWithTransformers("response-template")
go wiremock client sometime soon ?
also will below work if we havent passed `-local-response-templating`during startup ?
{
"request": {
"method": "POST",
"url": "/v2/operations"
},
"response": {
"status": 200,
"transformers": [
"response-template"
],
"bodyFileName": "reversal.json"
}
}
Balog Tamás
09/22/2023, 4:26 PMMuhammed Moussa
09/26/2023, 8:36 AM{{now}}
) using docker
image not jar
https://wiremock-community.slack.com/archives/C053Y3N34C8/p1695649886746049Lopamudra Rath
09/26/2023, 8:57 AMWireMock.setScenarioState("my_scenario", "state_2");
in Kotlin and Micronaut environment and it does not work