Skip to content

Commit

Permalink
http-tasks: use default variables (#1080)
Browse files Browse the repository at this point in the history
  • Loading branch information
brig authored Feb 13, 2025
1 parent be408d7 commit e37902e
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import javax.inject.Inject;
import javax.inject.Named;
import java.util.HashMap;
import java.util.Map;

@Named("http")
@DryRunReady
Expand All @@ -40,9 +39,12 @@ public HttpTaskV2(Context context) {

@Override
public TaskResult execute(Variables input) throws Exception {
Configuration config = Configuration.custom().build(context.workingDirectory().toString(), input.toMap(), context.processConfiguration().debug());
var inputMap = new HashMap<>(context.defaultVariables().toMap());
inputMap.putAll(input.toMap());

Map<String, Object> response = new HashMap<>(SimpleHttpClient.create(config, context.processConfiguration().dryRun()).execute().getResponse());
var config = Configuration.custom().build(context.workingDirectory().toString(), inputMap, context.processConfiguration().debug());

var response = new HashMap<>(SimpleHttpClient.create(config, context.processConfiguration().dryRun()).execute().getResponse());
return TaskResult.of((boolean)response.remove("success"), (String)response.remove("errorString"), response);
}
}

0 comments on commit e37902e

Please sign in to comment.