Source:
<code>private TaskResult run(TaskExecutionContext ctx, HttpClient httpClient) { SecretProvider httpSecrets = ctx.secrets().getSecrets("http"); URI uri = URI.create(httpSecrets.getSecretOptional("uri").or(() -> params.get("_command", String.class))); String method = params.get("method", String.class, "GET"); Optional<String> user = httpSecrets.getSecretOptional("user"); Optional<String> authorization = httpSecrets.getSecretOptional("authorization"); Request request = httpClient.newRequest(uri) .method(method) .timeout(30, SECONDS); if (authorization.isPresent()) { request.header(AUTHORIZATION, authorization.get()); } else if (user.isPresent()) { Optional<String> password = httpSecrets.getSecretOptional("password"); httpClient.getAuthenticationStore().addAuthenticationResult(new BasicAuthentication.BasicResult(uri, user.get(), password.or(""))); } Optional<String> content = params.getOptional("content", String.class); Optional<String> contentType = params.getOptional("content_type", String.class); boolean storeContent = params.get("store_content", boolean.class, false); if (content.isPresent()) { ContentProvider contentProvider = new StringContentProvider(content.get()); request.content(contentProvider, contentType.orNull()); } LinkedHashMultimap<String, String> headers = headers(); for (Map.Entry<String, String> header : headers.entries()) { request.header(header.getKey(), header.getValue()); } ContentResponse response = PollingRetryExecutor.pollingRetryExecutor(state, "request") <START> .withErrorMessage("HTTP request failed") <END> .run(s -> execute(request)); return result(response, storeContent); }</code><technical_language>retry receiving 408 429</technical_language>

Target:
private TaskResult run(TaskExecutionContext ctx, HttpClient httpClient) { SecretProvider httpSecrets = ctx.secrets().getSecrets("http"); URI uri = URI.create(httpSecrets.getSecretOptional("uri").or(() -> params.get("_command", String.class))); Optional<String> user = httpSecrets.getSecretOptional("user"); Optional<String> authorization = httpSecrets.getSecretOptional("authorization"); Request request = httpClient.newRequest(uri) .method(method) .timeout(30, SECONDS); if (authorization.isPresent()) { request.header(AUTHORIZATION, authorization.get()); } else if (user.isPresent()) { Optional<String> password = httpSecrets.getSecretOptional("password"); httpClient.getAuthenticationStore().addAuthenticationResult(new BasicAuthentication.BasicResult(uri, user.get(), password.or(""))); } Optional<JsonNode> content = params.getOptional("content", JsonNode.class); Optional<String> contentFormat = params.getOptional("content_format", String.class).transform(s -> s.toLowerCase(Locale.ROOT)); Optional<String> contentType = params.getOptional("content_type", String.class); boolean storeContent = params.get("store_content", boolean.class, false); if (content.isPresent()) { request.content(contentProvider(content.get(), contentFormat, contentType)); } LinkedHashMultimap<String, String> headers = headers(); for (Map.Entry<String, String> header : headers.entries()) { request.header(header.getKey(), header.getValue()); } configureQueryParameters(request); ContentResponse response = PollingRetryExecutor.pollingRetryExecutor(state, "request") .withErrorMessage("HTTP request failed") .run(s -> execute(request)); return result(response, storeContent); }