jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] [jmeter] FSchumacher commented on a change in pull request #651: Don't assume we have correct JSON at edit time
Date Thu, 18 Mar 2021 17:44:19 GMT

FSchumacher commented on a change in pull request #651:

File path: src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/util/
@@ -79,27 +76,32 @@ public static boolean isGraphQLContentType(final String contentType) {
      * @throws RuntimeException if JSON serialization fails for some reason due to any runtime
environment issues
     public static String toPostBodyString(final GraphQLRequestParams params) {
-        final ObjectMapper mapper = new ObjectMapper();
-        final ObjectNode postBodyJson = mapper.createObjectNode();
-        postBodyJson.set(OPERATION_NAME_FIELD,
-                JsonNodeFactory.instance.textNode(StringUtils.trimToNull(params.getOperationName())));
+        final StringBuilder result = new StringBuilder();

Review comment:
       I don't think, that we should add code to `HttpSamplerBase` as it doesn't have anything
to do with the GraphQL stuff (other than being used by the *GraphQlSampler*. I think we should
create a new class (we could call it `GraphQlSampler` :) ) that extends `HttpSamplerProxy`
and overrides the `sample` method. The new class could be injected by overriding `HttpTestSampleGui#createTestElement()`
in `GraphQLHTTPSampler`.
   Alternatively we could try to override the `modifyTestElement` method and do the JSON conversion
in there, when the test element is being prepared with the real data.

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.

For queries about this service, please contact Infrastructure at:

View raw message