add basic test for response

This commit is contained in:
Simon Cruanes 2025-04-15 10:14:25 -04:00
parent 4c8cc8ba5a
commit cdac33689a
No known key found for this signature in database
GPG key ID: EBFFF6F283F3A2B4
2 changed files with 18 additions and 1 deletions

View file

@ -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))

17
tests/unit/t_response.ml Normal file
View file

@ -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