diff options
author | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2019-04-29 13:47:20 +0200 |
---|---|---|
committer | Jon Marius Venstad <jvenstad@yahoo-inc.com> | 2019-04-29 13:47:20 +0200 |
commit | fd568af3e1f67ff581fc77d80d422ef152d8e3e6 (patch) | |
tree | dc4f6caa87a5800f4264e2af26d69df6ee778480 /hosted-api/src | |
parent | 9b2cccc9a3c3c919ed56c0bd65ca652a797bd4a1 (diff) |
Use MultiPartStreamer in ApplicationApiTest for verification
Diffstat (limited to 'hosted-api/src')
-rw-r--r-- | hosted-api/src/main/java/ai/vespa/hosted/api/MultiPartStreamer.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/hosted-api/src/main/java/ai/vespa/hosted/api/MultiPartStreamer.java b/hosted-api/src/main/java/ai/vespa/hosted/api/MultiPartStreamer.java index 7ed86210957..6b2f5596fd6 100644 --- a/hosted-api/src/main/java/ai/vespa/hosted/api/MultiPartStreamer.java +++ b/hosted-api/src/main/java/ai/vespa/hosted/api/MultiPartStreamer.java @@ -56,6 +56,14 @@ public class MultiPartStreamer { return this; } + /** Adds the given data as a named part in this, using the {@code "application/octet-stream" content type}. */ + public MultiPartStreamer addBytes(String name, byte[] data) { + streams.add(() -> separator(name, "application/octet-stream")); + streams.add(() -> new ByteArrayInputStream(data)); + + return this; + } + /** Adds the contents of the file at the given path as a named part in this. */ public MultiPartStreamer addFile(String name, Path path) { streams.add(() -> separator(name, path)); |