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 PMRahul Verma
06/11/2023, 1:12 PMRahul Verma
06/11/2023, 1:21 PMRahul Verma
06/11/2023, 1:22 PMRahul Verma
06/11/2023, 1:23 PMWireMock wireMock = WireMock.create()
.scheme("http")
.host("3.26.179.130")
.port(57168)
.build();
wireMock.loadMappingsFrom("/wiremock-stuff");
Anzar Ahsan
06/12/2023, 2:30 PMAlbert Vesker
06/12/2023, 8:42 PMKushagra Kapoor
06/13/2023, 11:43 AMIstvan Szajko
06/14/2023, 6:14 AMMorgan Blanloeil
06/14/2023, 1:41 PMSai Srihitha Reddy Thummala
06/15/2023, 1:29 PMIu Dragon
06/16/2023, 12:36 AMpoongodi
06/16/2023, 7:43 AMTheUsharik
06/16/2023, 11:33 AMPrasenjit Dutta
06/17/2023, 7:13 AMRahul Verma
06/18/2023, 3:20 PMTheUsharik
06/20/2023, 9:34 AMGee
06/20/2023, 10:29 AMPragya Rai
06/20/2023, 10:31 PMwiremock:
proxies:
- service-name: ABC
port: 9091
url: <https://abc.com>
mappings-path: /wiremock/abc
recording: false
Mahi Vasi
06/21/2023, 4:17 AMAbhishek Bedi
06/21/2023, 9:16 AM--proxy-all
but no luckPrasenjit Dutta
06/21/2023, 3:35 PM