oEscal commented on code in PR #3927:
URL:
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3927#discussion_r2163958204
##########
quarkus/addons/knative/serving/integration-tests/src/test/java/org/kie/kogito/addons/quarkus/knative/serving/customfunctions/it/KnativeServingAddonIT.java:
##########
@@ -341,12 +426,85 @@ private void mockExecuteHttpGetEndpoint() {
private void mockExecuteWithArrayEndpoint() {
wireMockServer.stubFor(post(urlEqualTo("/arrayFunction"))
.withRequestBody(equalToJson(JsonNodeFactory.instance.objectNode()
- .set("array",
JsonNodeFactory.instance.arrayNode().add("Javierito").add("Pepito"))
+ .set("array",
JsonNodeFactory.instance.arrayNode().add("Javierito")
+ .add("Pepito"))
+ .toString()))
+ .willReturn(aResponse()
+ .withStatus(HttpURLConnection.HTTP_OK)
+ .withHeader("Content-Type", "application/json")
+ .withJsonBody(JsonNodeFactory.instance.objectNode()
+ .put("message",
JsonNodeFactory.instance.arrayNode()
+ .add(23).add(24).toPrettyString()))));
+ }
+
+ private void mockExecuteWithHeadersEndpoint() {
+ wireMockServer.stubFor(post(urlEqualTo("/headersFunction"))
+ .withHeader("Test", equalTo("test"))
+ .withHeader("Authorization", equalTo("Bearer token"))
+ .willReturn(aResponse()
+ .withStatus(HttpURLConnection.HTTP_OK)
+ .withHeader("Content-Type", "application/json")
+ .withJsonBody(JsonNodeFactory.instance.objectNode()
+ .put("message", "Headers added
successfully"))));
+ }
+
+ private void mockExecuteWithQueryParametersPostEndpoint() {
+
wireMockServer.stubFor(post(urlEqualTo("/queryParamsFunction?param2=value2¶m1=value1"))
+
.withRequestBody(equalToJson(JsonNodeFactory.instance.objectNode()
+ .put("param3", "value3")
+ .toString()))
+ .willReturn(aResponse()
+ .withStatus(HttpURLConnection.HTTP_OK)
+ .withHeader("Content-Type", "application/json")
+ .withJsonBody(JsonNodeFactory.instance.objectNode()
+ .put("message", "Query parameters added
successfully"))));
+ }
+
+ private void mockExecuteWithHeadersAndQueryParametersPostEndpoint() {
+
wireMockServer.stubFor(post(urlEqualTo("/headersAndQueryParamsFunction?param1=value1"))
+
.withRequestBody(equalToJson(JsonNodeFactory.instance.objectNode()
+ .put("param2", "value2")
.toString()))
+ .withHeader("Authorization", equalTo("Bearer token"))
+ .willReturn(aResponse()
+ .withStatus(HttpURLConnection.HTTP_OK)
+ .withHeader("Content-Type", "application/json")
+ .withJsonBody(JsonNodeFactory.instance.objectNode()
+ .put("message", "Headers and query parameters
added successfully"))));
+ }
+
+ private void mockExecuteWithQueryParametersEndpoint() {
+ wireMockServer.stubFor(get(
+
urlEqualTo("/queryParamsFunction?QUERY_param3=value3¶m1=value1¶m2=value2"))
Review Comment:
Since this is for GET requests, I was trying to support the "standard" way
of defining parameters. That is why I avoided using `isQueryParameter`, because
that implementation in super is meant for POST requests (that is why it
verifies if the parameter prefix is `QUERY_`. If I do the validation using the
`isQueryParameter`, I will force developers to define parameters with the
`QUERY_` prefix in GET requests, which does not seem to be very handy.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]