ruanwenjun commented on code in PR #18085:
URL:
https://github.com/apache/dolphinscheduler/pull/18085#discussion_r2960448280
##########
dolphinscheduler-task-plugin/dolphinscheduler-task-http/src/test/java/org/apache/dolphinscheduler/plugin/task/http/HttpTaskTest.java:
##########
@@ -145,6 +146,30 @@ public void testHandleWithHttpBody() throws Exception {
Assertions.assertEquals(EXIT_CODE_SUCCESS,
httpTask.getExitStatusCode());
}
+ @Test
+ public void testHandleWithComplexHttpBody() throws Exception {
+ String httpBody =
"{\"name\":\"tom\",\"scores\":[100,98],\"metadata\":{\"grade\":\"A\"}}";
+ String httpResponse = "{\"status\": \"success\"}";
+
+ MockWebServer server = new MockWebServer();
+ mockWebServers.add(server);
+ server.start();
+ server.setDispatcher(generateMockDispatcher(DEFAULT_MOCK_PATH,
HttpStatus.SC_OK, httpResponse));
+
+ String paramData =
generateHttpParameters(server.url(DEFAULT_MOCK_PATH).toString(),
HttpRequestMethod.POST,
+ httpBody, new ArrayList<>(),
HttpCheckCondition.STATUS_CODE_DEFAULT, "");
+ HttpTask httpTask = generateHttpTaskFromParamData(paramData, null);
Review Comment:
Can we directly use `generateHttpTask` to generate http task and server?
--
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]