From cdac33689ada83229bdca657057a85b15d2f5928 Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Tue, 15 Apr 2025 10:14:25 -0400 Subject: [PATCH] add basic test for response --- tests/unit/dune | 2 +- tests/unit/t_response.ml | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 tests/unit/t_response.ml diff --git a/tests/unit/dune b/tests/unit/dune index 4aa1fc95..bb3c8960 100644 --- a/tests/unit/dune +++ b/tests/unit/dune @@ -1,4 +1,4 @@ (tests - (names t_util t_buf t_server t_io) + (names t_util t_buf t_server t_io t_response) (package tiny_httpd) (libraries tiny_httpd.core qcheck-core qcheck-core.runner test_util)) diff --git a/tests/unit/t_response.ml b/tests/unit/t_response.ml new file mode 100644 index 00000000..2df31cb8 --- /dev/null +++ b/tests/unit/t_response.ml @@ -0,0 +1,17 @@ +open Test_util +open Tiny_httpd_core +module U = Util + +let () = + let res = + Response.make_raw ~code:200 ~headers:[ "content-length", "42" ] "" + in + let h = Headers.get_exn "content-length" res.headers in + assert_eq "42" h + +let () = + let res = + Response.make_raw ~code:200 ~headers:[ "Content-Length", "42" ] "" + in + let h = Headers.get_exn "content-length" res.headers in + assert_eq "42" h