better if-not-match

This commit is contained in:
swrup 2026-02-12 11:25:57 +01:00
parent c4475d6908
commit 7baba82a10
7 changed files with 107 additions and 106 deletions

View file

@ -189,6 +189,15 @@ let ed25519 s =
|> Result.map_error (fun e -> Fmt.str "%a" Mirage_crypto_ec.pp_error e)
|> unwrap
let etag s =
match Headers_lib.Etag.parse s with
| Ok etag -> etag
| Error e -> (
(* retry with quotes if needed *)
match Headers_lib.Etag.parse (Fmt.str "\"%s\"" s) with
| Ok etag -> etag
| Error _ -> fail "could not parse etag `%s`: %s" s e)
(* TODO
move to another module
can we type the json as a Int_map directly? *)