From 9ba7ea76a9b0f0041a81a4b6f513f80499929c29 Mon Sep 17 00:00:00 2001 From: Mohammed Al Sahaf Date: Tue, 29 Oct 2024 20:52:17 +0000 Subject: [PATCH] add test case for `request_body` handler --- caddytest/spec/http/requestbody/spec.hurl | 35 +++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 caddytest/spec/http/requestbody/spec.hurl diff --git a/caddytest/spec/http/requestbody/spec.hurl b/caddytest/spec/http/requestbody/spec.hurl new file mode 100644 index 00000000..3971fddd --- /dev/null +++ b/caddytest/spec/http/requestbody/spec.hurl @@ -0,0 +1,35 @@ +# Configure Caddy +POST http://localhost:2019/load +Content-Type: text/caddyfile +``` +{ + skip_install_trust + http_port 9080 + https_port 9443 + local_certs +} +localhost { + log + request_body { + max_size 2B + } + reverse_proxy localhost:8000 # to fake body reading + handle_errors 4xx { + respond "OK" + } +} +http://localhost:8000 { + respond "Failed" +} +``` + +GET https://localhost:9443 +[Options] +insecure: true +``` +Hello +``` +HTTP 413 +`OK` + +# TODO: how to test{read,write}_timeout? \ No newline at end of file