Muthukkumar Ponnusamy
05/11/2023, 4:11 AMSlackbot
05/11/2023, 6:27 PMMuthukkumar Ponnusamy
05/16/2023, 9:13 PMMaarten Aerts
05/17/2023, 1:54 PMFb
05/17/2023, 2:07 PMTarun Bhalla
05/17/2023, 6:12 PMJulian Michelmann
05/19/2023, 8:20 AMKapish Malik
05/19/2023, 12:50 PMLorenzo Motti
05/19/2023, 1:32 PMBrett Burch
05/19/2023, 4:30 PMMuthukkumar Ponnusamy
05/19/2023, 6:05 PMPOST /__admin/recordings/start
{
"targetBaseUrl": "<http://examples.wiremockapi.cloud/>"
}
transformer: [ "modify-request-body" ]
Sam
05/22/2023, 12:32 PMWatchStaticMappingsInSubdirectories
but cannot see anywhere how to configure the tool to use this
many thanks!mahbaleshwar hegde
05/24/2023, 8:01 AM{
"mappings": [
{
"priority": 1,
"request": {
"method": "GET",
"url": "/posts"
},
"response": {
"status": 200,
"bodyFileName": "posts-default.json"
}
},
{
"priority": 2,
"request": {
"url": "/posts"
},
"response": {
"status": 200,
"bodyFileName": "posts-empty.json"
}
},
{
"priority": 3,
"request": {
"url": "/posts"
},
"response": {
"status": 500,
"bodyFileName": "posts-error.json"
}
}
]
}
Can anyone help me how to achieve one url which has multiple response?Kashyap Achar
05/24/2023, 3:51 PMAmey Gulhane
05/25/2023, 11:12 AMJernej Goricki
05/25/2023, 1:37 PMTanumoy Mitra
05/25/2023, 4:30 PMAlbert Vesker
05/26/2023, 9:51 AMHarsh Singh
05/28/2023, 1:46 PMAnton Smirnov
05/30/2023, 7:51 AMNodir Musaev
05/30/2023, 7:59 AMHello,
By default the .postMapping method creates a stub using an URLRequest with a default Content-Type “application/x-www-form-urlencoded”, which is incorrect. The value of this header should be “application/json” since the body is actually JSON.
I am having an issue where a security equipment between my client code and the mock server blocks all stub creations because of the incorrect value of this HTTP Header.
I tested that the correct value “application/json” works as intended.
Do you think it would be possible to use the correct value for all stub creations please ?
Thank you for your help.
(If you need, I can provide a PR)We are facing same problem. In response data we printed result:
(lldb) po String(data: data!, encoding: .utf8)
â–ż Optional<String>
- some : "{\n \"errors\" : [ {\n \"code\" : 10,\n \"source\" : { },\n \"title\" : \"Error parsing JSON\",\n \"detail\" : \"Unexpected character (\'%\' (code 37)): expected a valid value (JSON String, Number, Array, Object or token \'null\', \'true\' or \'false\')\\n at [Source: (String)\\\"... more response data code here
Hamado Dene
05/30/2023, 8:13 PMHttpClient client =
HttpClient.create()
.protocol(HTTP1.1, H2C, H2 );
We are having several problems in our tests when configuring the HTTP1.1 protocol together with another HTTP2 protocol.
Basically when HTTP1.1 is configured together with H2C or H2, reactor netty at the first request sends a request of type Connection: upgrade to understand what type of protocol the server supports in order to use the right protocol for the request.
However, we noticed that wiremock does not handle Connection: Upgrade requests.
wireMockRule.stubFor(
post(urlEqualTo("/index.html")).
withRequestBody(equalTo("Wikipedia in\r\n"
+ "\r\n"
+ "chunks."))
.willReturn(aResponse()
.withStatus(200)
.withHeader("Content-Type", "text/html")
.withBody("it <b>works</b> !!"))
);
By placing a subFor of this type, we see that when the Connection: upgrade request arrives, it sees that the body is empty, so it breaks and closes the connection without actually managing the connection upgrade.
We tried to introduce a subFor that manages the case in which a connection: upgrade arrives but the problem is that after having managed, wiremock closes the connection and therefore reactor netty is unable to continue the request.
In particular we did something like:
wireMockRule.stubFor(
post(urlEqualTo("/index.html"))
.withHeader(String.valueOf(HttpHeaderNames.CONNECTION), containing("upgrade") )
.willReturn(aResponse()
.withStatus(200)
.withHeader(String.valueOf(HttpHeaderNames.CONNECTION), "upgrade")
.withHeader(String.valueOf(HttpHeaderNames.UPGRADE), "HTTP/2.0")
));
wireMockRule.stubFor(
post(urlEqualTo("/index.html")).
withRequestBody(equalTo("Wikipedia in\r\n"
+ "\r\n"
+ "chunks."))
.willReturn(aResponse()
.withStatus(200)
.withHeader("Content-Type", "text/html")
.withBody("it <b>works</b> !!"))
);
The problem, however, is that by matching the first subFor, it still immediately closes the connection. So reactor netty is not able to go and send data.
If configured together H2C and H2 the problem does not arise as Connection:upgrade over http2 is not supported.
If configured HTTP1.1 alone the problem does not arise.
Do you have a solution to handle this issue?Kapish Malik
06/02/2023, 2:45 AMAlbert Vesker
06/02/2023, 11:16 AMArmen Yeganyan
06/02/2023, 11:57 AMNodir Musaev
06/04/2023, 7:18 PM"year": "{{now format='yyyy' type='NUMERIC'}}",
"month": "{{now format='M' type='NUMERIC'}}",
"day": "{{now format='d' type='NUMERIC'}}",
"hour": "{{now format='h' type='NUMERIC'}}",
But this doesn’t work. Main idea is that I generate components(year, month, day…) from date with formats and then I want to make it to integer types to decode it, because backend sends this fields in integer type. Or maybe someone can suggest another way to mock response like that?Nikolas Andersen
06/06/2023, 4:21 PMstubFor
, com.github.tomakehurst.wiremock.client.WireMock.get
, urlPathMatching
, willReturn
, aResponse
, withHeader
, withBody
available_,_
but not @WireMockTest
, WireMockExtension
or withHost
, for example.Jackie chen
06/07/2023, 7:31 AMAnton Smirnov
06/07/2023, 6:56 PMAnzar Ahsan
06/09/2023, 6:21 PM