jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject [jmeter] 06/13: Use #set instead of deprecated #put
Date Sat, 10 Oct 2020 11:29:07 GMT
This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git

commit 69fcb56ccd169f75ead92a738113c72a086eb663
Author: Felix Schumacher <felix.schumacher@internetallee.de>
AuthorDate: Thu Oct 8 18:18:51 2020 +0200

    Use #set instead of deprecated #put
---
 .../apache/jmeter/protocol/http/util/GraphQLRequestParamUtils.java  | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/util/GraphQLRequestParamUtils.java
b/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/util/GraphQLRequestParamUtils.java
index c471288..11c1cbf 100644
--- a/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/util/GraphQLRequestParamUtils.java
+++ b/src/protocol/http/src/main/java/org/apache/jmeter/protocol/http/util/GraphQLRequestParamUtils.java
@@ -37,6 +37,7 @@ import org.slf4j.LoggerFactory;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
 import com.fasterxml.jackson.databind.node.JsonNodeType;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 
@@ -74,7 +75,8 @@ public final class GraphQLRequestParamUtils {
     public static String toPostBodyString(final GraphQLRequestParams params) {
         final ObjectMapper mapper = new ObjectMapper();
         final ObjectNode postBodyJson = mapper.createObjectNode();
-        postBodyJson.put("operationName", StringUtils.trimToNull(params.getOperationName()));
+        postBodyJson.set("operationName",
+                JsonNodeFactory.instance.textNode(StringUtils.trimToNull(params.getOperationName())));
 
         if (StringUtils.isNotBlank(params.getVariables())) {
             try {
@@ -86,7 +88,7 @@ public final class GraphQLRequestParamUtils {
             }
         }
 
-        postBodyJson.put("query", StringUtils.trim(params.getQuery()));
+        postBodyJson.set("query", JsonNodeFactory.instance.textNode(StringUtils.trim(params.getQuery())));
 
         try {
             return mapper.writeValueAsString(postBodyJson);


Mime
View raw message