Skip to content

Commit ed45ea0

Browse files
committed
HTTP body as bytes test
1 parent ec40df0 commit ed45ea0

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package org.jooby;
2+
3+
import java.nio.charset.StandardCharsets;
4+
5+
import org.jooby.test.ServerFeature;
6+
import org.junit.Test;
7+
8+
public class ByteBodyFeature extends ServerFeature {
9+
10+
{
11+
post("/bytes", req -> {
12+
return new String(req.body(byte[].class), StandardCharsets.UTF_8);
13+
});
14+
}
15+
16+
@Test
17+
public void shouldReadBodyAsByteArray() throws Exception {
18+
request()
19+
.post("/bytes")
20+
.body("foo", "text/plain")
21+
.expect("foo");
22+
}
23+
}

0 commit comments

Comments
 (0)