package ez_api
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
Easy API library and tools
Install
dune-project
Dependency
Authors
Maintainers
Sources
3.0.0.tar.gz
md5=9069f59ac83c958cedc90a25f24faa1e
sha512=4b066a759043e6704a9617bdc412d29f7ded058cb0e01eb3a8207f54b80bebb478bb98a96832e61b15d281bc8f132e1386459c563eb807a51c01324541fe28b2
doc/src/ez_api.request_verbose/verbose.ml.html
Source file verbose.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48(**************************************************************************) (* *) (* Copyright 2018-2023 OCamlPro *) (* *) (* All rights reserved. This file is distributed under the terms of the *) (* GNU Lesser General Public License version 2.1, with the special *) (* exception on linking described in the file LICENSE. *) (* *) (**************************************************************************) (* verbose binary flag 1: string received over http 2: string sent over http 4: library logs or headers *) let v = match Sys.getenv_opt "EZAPICLIENT" with | Some "true" -> ref 7 | Some x -> begin match int_of_string_opt x with | None -> ref 0 | Some i -> ref i end | _ -> ref 0 let callback = ref (fun (_ : int) -> ()) let set_verbose i = v := i; !callback i let log ?(meth="GET") url = function | None -> if !v <> 0 then Format.eprintf "[ez_api] %s %s@." meth url | Some msg -> Format.eprintf "[>%s %s %s]" msg meth url let request ?msg ?meth ?content ?(headers=[]) url = log ?meth url msg; (if !v land 4 <> 0 then Format.printf "[ez_api] headers\n %s@." @@ String.concat "\n " @@ List.map (fun (k, v) -> k ^ " : " ^ v) headers); if !v land 2 <> 0 then match content with | Some s when s <> "" -> Format.printf "[ez_api] sent:\n%s@." s | _ -> () let response ?msg ~code ~content url = log ~meth:("RECV " ^ string_of_int code) url msg; if !v land 1 <> 0 && content <> "" then Format.printf "[ez_api] received:\n%s@." content
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>