HTTP types: headers, status codes, methods, bodies, MIME types
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocaml-http: extend MDX to lib/cache_control.mli

Add cache_control.mli to the (mdx ...) stanza. The example was
already concrete; tightened to assert on parsed [max_age]/[public]
fields and the [is_cacheable] decision instead of just printing.

+8 -7
+7 -6
lib/cache_control.mli
··· 14 14 {2 Examples} 15 15 16 16 {[ 17 - (* Parse response Cache-Control *) 18 - let cc = Cache_control.parse_response "max-age=3600, public" in 19 - Printf.printf "Max age: %d\n" (Option.get cc.max_age); 17 + open Http 18 + 19 + let cc = Cache_control.parse_response "max-age=3600, public" 20 20 21 - (* Check if cacheable *) 22 - if Cache_control.is_cacheable ~response_cc:cc ~status:200 then 23 - Printf.printf "Response is cacheable\n" 21 + let () = 22 + assert (cc.max_age = Some 3600); 23 + assert (cc.public = true); 24 + assert (Cache_control.is_cacheable ~response_cc:cc ~status:200) 24 25 ]} *) 25 26 26 27 val src : Logs.Src.t
+1 -1
lib/dune
··· 14 14 fmt)) 15 15 16 16 (mdx 17 - (files http_date.mli huri.mli expect_continue.mli) 17 + (files http_date.mli huri.mli expect_continue.mli cache_control.mli) 18 18 (libraries nox-http requests uri eio eio.core eio.unix eio_main))