aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2024-02-21 23:47:35 -0700
committerAndrew Kelley <andrew@ziglang.org>2024-02-23 02:37:11 -0700
commitabde76a808df816ea12a8a2dbf8e6b53ff9b110f (patch)
treed817c13501789ae507fc29a069f344eaed28c286 /test
parent380916c0f8883746e4d84d5334f68d0569d76f38 (diff)
downloadzig-abde76a808df816ea12a8a2dbf8e6b53ff9b110f.tar.gz
zig-abde76a808df816ea12a8a2dbf8e6b53ff9b110f.zip
std.http.Server: handle expect: 100-continue requests
The API automatically handles these requests as expected. After receiveHead(), the server has a chance to notice the expectation and do something about it. If it does not, then the Server implementation will handle it by sending the continuation header when the read stream is created. Both respond() and respondStreaming() send the continuation header as part of discarding the request body, only if the read stream has not already been created.
Diffstat (limited to 'test')
-rw-r--r--test/standalone/http.zig12
1 files changed, 1 insertions, 11 deletions
diff --git a/test/standalone/http.zig b/test/standalone/http.zig
index 5b44a14032..ff6467fc6c 100644
--- a/test/standalone/http.zig
+++ b/test/standalone/http.zig
@@ -26,17 +26,7 @@ fn handleRequest(request: *http.Server.Request, listen_port: u16) !void {
request.head.target,
});
- if (request.head.expect) |expect| {
- if (mem.eql(u8, expect, "100-continue")) {
- @panic("test failure, didn't handle expect 100-continue");
- } else {
- return request.respond("", .{
- .status = .expectation_failed,
- });
- }
- }
-
- const body = try request.reader().readAllAlloc(salloc, 8192);
+ const body = try (try request.reader()).readAllAlloc(salloc, 8192);
defer salloc.free(body);
var send_buffer: [100]u8 = undefined;