Polish http rewrites (#1133)

* Polish rewrite docs
* Add documentation comments, add missing evaluator options
* Add ability to set HTTP builder in ConfigEvaluatorBuilder
* Add ability to set rewrites in executor API
This commit is contained in:
Daniel Chao
2025-07-22 15:42:07 -07:00
committed by GitHub
parent fe064960b4
commit 306a3b0fc2
7 changed files with 225 additions and 54 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,6 +25,7 @@ import org.pkl.config.java.mapper.ValueMapperBuilder;
import org.pkl.core.EvaluatorBuilder;
import org.pkl.core.SecurityManager;
import org.pkl.core.StackFrameTransformer;
import org.pkl.core.http.HttpClient;
import org.pkl.core.project.DeclaredDependencies;
import org.pkl.core.project.Project;
import org.pkl.core.util.Nullable;
@@ -242,6 +243,15 @@ public final class ConfigEvaluatorBuilder {
return this;
}
/**
* Returns the currently set evaluation timeout.
*
* <p>This is a convenience method that delegates to the underlying evaluator builder.
*/
public @Nullable Duration getTimeout() {
return evaluatorBuilder.getTimeout();
}
/**
* Sets the set of URI patterns to be allowed when importing modules.
*
@@ -305,12 +315,24 @@ public final class ConfigEvaluatorBuilder {
}
/**
* Returns the currently set evaluation timeout.
* Sets the HTTP Client to be used.
*
* <p>This is a convenience method that delegates to the underlying evaluator builder.
* <p>Defaults to {@code HttpClient.builder().buildLazily()}.
*
* @since 0.29.0
*/
public @Nullable Duration getTimeout() {
return evaluatorBuilder.getTimeout();
public ConfigEvaluatorBuilder setHttpClient(HttpClient httpClient) {
evaluatorBuilder.setHttpClient(httpClient);
return this;
}
/**
* Returns the currently set HTTP client.
*
* @since 0.29.0
*/
public HttpClient getHttpClient() {
return evaluatorBuilder.getHttpClient();
}
/**