Skip to content

Commit f8aad91

Browse files
committed
print headers logs in httpun requests
1 parent 21d4a50 commit f8aad91

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

src/request/unix/httpun/httpun_client.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ let perform ?msg ?meth ?content ?content_type ?(headers=[]) ?timeout handler url
115115
| _, None -> `GET
116116
| _ -> `POST in
117117
log ~meth:(Method.to_string meth) url msg;
118+
(if !Verbose.v land 4 <> 0 then
119+
Format.printf "[ez_api] headers\n %s@." @@
120+
String.concat "\n " @@ List.map (fun (k, v) -> k ^ " : " ^ v) headers);
118121
(match !Verbose.v land 2 <> 0, content with
119122
| true, Some content when content <> "" -> Format.printf "[ez_api] sent:\n%s@." content;
120123
| _ -> ());

src/request/verbose.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
verbose binary flag
1313
1: string received over http
1414
2: string sent over http
15-
4: library logs
15+
4: library logs or headers
1616
*)
1717

1818
let v = match Sys.getenv_opt "EZAPICLIENT" with

0 commit comments

Comments
 (0)