From fb8229f7e656a4475fb01e4ea8912a97273c3b15 Mon Sep 17 00:00:00 2001 From: Joshua Bauer Date: Thu, 16 Jan 2020 13:08:44 -0800 Subject: [PATCH] Allow byte arrays in response bodies. --- .../java/io/sinistral/proteus/server/ServerResponse.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/proteus-core/src/main/java/io/sinistral/proteus/server/ServerResponse.java b/proteus-core/src/main/java/io/sinistral/proteus/server/ServerResponse.java index 7fe041b..b3b749c 100644 --- a/proteus-core/src/main/java/io/sinistral/proteus/server/ServerResponse.java +++ b/proteus-core/src/main/java/io/sinistral/proteus/server/ServerResponse.java @@ -180,6 +180,13 @@ public ServerResponse body(ByteBuffer body) return this; } + public ServerResponse body(byte[] body) + { + this.body = ByteBuffer.wrap(body); + this.preprocessed = true; + return this; + } + public ServerResponse body(String body) { return this.body(ByteBuffer.wrap(body.getBytes()));