jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [jmeter] woonsan commented on a change in pull request #651: Don't assume we have correct JSON at edit time
Date Mon, 29 Mar 2021 12:45:08 GMT

woonsan commented on a change in pull request #651:
URL: https://github.com/apache/jmeter/pull/651#discussion_r603261987



##########
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:
       Hi @FSchumacher ,
   
   I think the simplest solution can be the following:
   - Keep the current way to generate/parse to/from JSON string as a whole.
   - However, do not parse the variables string to a json at all (as the string is not purely
json any more).
   - So, just make `GraphQLRequestParamUtils.variablesToGetParamValue(String)` generate KV
style encoded JSON-like string.
   
   Then I think the problem will be solved only by improving `GraphQLRequestParamUtils.variablesToGetParamValue(String)`.
   
   Regards,
   
   Woonsan




-- 
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:
users@infra.apache.org



Mime
View raw message