diff options
author | Valerij Fredriksen <freva@users.noreply.github.com> | 2022-11-07 15:10:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-07 15:10:06 +0100 |
commit | adc1c1fa16945d9f29778706f5bf8161434c2361 (patch) | |
tree | 4e1d28d33c02a86c179c94fda29158b4ada9d2c9 /http-client/src/main/java/ai/vespa/hosted/client/HttpClient.java | |
parent | a0e9b51aaf01a425dbd6cdd1fbc8fd5ce066a9bb (diff) | |
parent | a0a5b2d3c7cb9319590821bb1beb824dc25d1b89 (diff) |
Merge pull request #24781 from vespa-engine/revert-24777-jonmv/reapply-app-streams
Revert "Jonmv/reapply app streams"
Diffstat (limited to 'http-client/src/main/java/ai/vespa/hosted/client/HttpClient.java')
-rw-r--r-- | http-client/src/main/java/ai/vespa/hosted/client/HttpClient.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/http-client/src/main/java/ai/vespa/hosted/client/HttpClient.java b/http-client/src/main/java/ai/vespa/hosted/client/HttpClient.java index 4da887f0cbb..ea8328ed793 100644 --- a/http-client/src/main/java/ai/vespa/hosted/client/HttpClient.java +++ b/http-client/src/main/java/ai/vespa/hosted/client/HttpClient.java @@ -78,6 +78,12 @@ public interface HttpClient extends Closeable { RequestBuilder body(byte[] json); /** Sets the request body. */ + default RequestBuilder body(HttpEntity entity) { + if (entity.isRepeatable()) return body(() -> entity); + throw new IllegalArgumentException("entitiy must be repeatable, or a supplier must be used"); + } + + /** Sets the request body. */ RequestBuilder body(Supplier<HttpEntity> entity); /** Sets query parameters without a value, like {@code ?debug&recursive}. */ |