mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2025-12-05 19:00:32 -05:00
add basic test for response
This commit is contained in:
parent
4c8cc8ba5a
commit
cdac33689a
2 changed files with 18 additions and 1 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
(tests
|
(tests
|
||||||
(names t_util t_buf t_server t_io)
|
(names t_util t_buf t_server t_io t_response)
|
||||||
(package tiny_httpd)
|
(package tiny_httpd)
|
||||||
(libraries tiny_httpd.core qcheck-core qcheck-core.runner test_util))
|
(libraries tiny_httpd.core qcheck-core qcheck-core.runner test_util))
|
||||||
|
|
|
||||||
17
tests/unit/t_response.ml
Normal file
17
tests/unit/t_response.ml
Normal 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
|
||||||
Loading…
Add table
Reference in a new issue