Skip to content

Commit

Permalink
HttpActivityExecutor: Keep setting variable content to null for Json …
Browse files Browse the repository at this point in the history
…response with no content.

Jackson 2.10 changed the behavior for ObjectMapper.readTree(input) for no content (see: FasterXML/jackson-databind#2211).
  • Loading branch information
PascalSchumacher committed Sep 26, 2019
1 parent 2c1bafe commit 15b22e0
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
import org.slf4j.LoggerFactory;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.MissingNode;

/**
* An executor behavior for HTTP requests.
Expand Down Expand Up @@ -116,6 +117,9 @@ public void execute(HttpRequest request, VariableContainer variableContainer, St
if (!response.isBodyResponseHandled()) {
String varName = StringUtils.isNotEmpty(responseVariableName) ? responseVariableName : request.getPrefix() + "ResponseBody";
Object varValue = request.isSaveResponseAsJson() && response.getBody() != null ? objectMapper.readTree(response.getBody()) : response.getBody();
if (varValue instanceof MissingNode) {
varValue = null;
}
if (request.isSaveResponseTransient()) {
variableContainer.setTransientVariable(varName, varValue);
} else {
Expand Down

0 comments on commit 15b22e0

Please sign in to comment.