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: fix huri.mli example to compile under MDX

The example used 'let .. in ..' top-level form (only valid inside an
expression), bare 'Uri' / 'Huri' references that don't resolve under
'open Http', and a top-level Eio.Buf_write.with_flow that needed a
'flow' value MDX can't bind. Rewrite as let-bindings, qualify Huri as
Http.Huri, and wrap the with_flow call in a 'run flow' function so the
example is callable rather than a side-effect at module init.

+6 -5
+6 -5
lib/huri.mli
··· 23 23 {2 Usage} 24 24 25 25 {[ 26 - (* Use Uri for parsing and manipulation *) 27 - let uri = Uri.of_string "https://example.com/path" in 28 - let host = Uri.host uri in 26 + (* Use Uri for parsing and manipulation. *) 27 + let uri = Uri.of_string "https://example.com/path" 28 + let () = assert (Uri.host uri = Some "example.com") 29 29 30 - (* Use Huri.write for efficient serialization to Buf_write *) 31 - Eio.Buf_write.with_flow flow (fun w -> Huri.write w uri) 30 + (* Use Http.Huri.write for efficient serialization to a Buf_write 31 + backed by an Eio sink. *) 32 + let run flow = Eio.Buf_write.with_flow flow (fun w -> Http.Huri.write w uri) 32 33 ]} *) 33 34 34 35 (** {1 Type Alias} *)