From 6f2101ee6aa6333ff0b5553c11ef9656973a6cc6 Mon Sep 17 00:00:00 2001 From: Ruud Senden <8635138+rsenden@users.noreply.github.com> Date: Wed, 14 Dec 2022 15:22:43 +0100 Subject: [PATCH] fix: `fcli ssc issue-template create`: Display 'Default template=true' if `--set-as-default` specified (fixes #180) --- .../cli/cmd/SSCIssueTemplateCreateCommand.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fcli-ssc/src/main/java/com/fortify/cli/ssc/issue_template/cli/cmd/SSCIssueTemplateCreateCommand.java b/fcli-ssc/src/main/java/com/fortify/cli/ssc/issue_template/cli/cmd/SSCIssueTemplateCreateCommand.java index 582012b250..4c1272383e 100644 --- a/fcli-ssc/src/main/java/com/fortify/cli/ssc/issue_template/cli/cmd/SSCIssueTemplateCreateCommand.java +++ b/fcli-ssc/src/main/java/com/fortify/cli/ssc/issue_template/cli/cmd/SSCIssueTemplateCreateCommand.java @@ -33,6 +33,7 @@ import com.fortify.cli.ssc.output.cli.cmd.AbstractSSCOutputCommand; import com.fortify.cli.ssc.output.cli.mixin.SSCOutputHelperMixins; import com.fortify.cli.ssc.rest.SSCUrls; +import com.fortify.cli.ssc.rest.bulk.SSCBulkRequestBuilder; import io.micronaut.core.annotation.ReflectiveAccess; import kong.unirest.UnirestInstance; @@ -67,8 +68,12 @@ public JsonNode getJsonNode(UnirestInstance unirest) { if ( setAsDefault ) { ObjectNode data = (ObjectNode)body.get("data").deepCopy(); data.put("defaultTemplate", true); - body = unirest.put(SSCUrls.ISSUE_TEMPLATE(data.get("id").asText())) - .body(data).asObject(JsonNode.class).getBody(); + String url = SSCUrls.ISSUE_TEMPLATE(data.get("id").asText()); + body = new SSCBulkRequestBuilder() + .request("update", unirest.put(url).body(data)) + .request("result", unirest.get(url)) + .execute(unirest) + .body("result"); } return body; }