FSchumacher commented on a change in pull request #651:
URL: https://github.com/apache/jmeter/pull/651#discussion_r593795217
##########
File path:
src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/util/GraphQLRequestParamUtils.java
##########
@@ -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:
Yes, it is probably better to move the logic of generating the JSON to a
phase when the variables are already evaluated. Normally this would be done in
the `sample` method. In the GraphQL Sampler case that means more work, as it is
more like a tool to fill a normal HTTP Sampler.
----------------------------------------------------------------
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:
[email protected]