Accept utf-8 in content-type

This commit is contained in:
orbifx 2021-09-26 14:18:43 +01:00
parent 40e57b68eb
commit e075e2601b

View File

@ -7,7 +7,8 @@ let http_body fn uri =
let response (headers, body) =
let open Cohttp in
match Header.get (headers |> Response.headers) "content-type" with
| Some "application/msgpack" | Some "text/plain" | Some "application/octet-stream" -> Ok body
| Some "application/msgpack" | Some "application/octet-stream"
| Some "text/plain" | Some "text/plain; charset=utf-8" -> Ok body
| Some x -> Error ("Invalid content-type: " ^ x)
| None -> Error ("No content-type")