1234567891011121314151617181920212223(* This file is part of Dream, released under the MIT license. See LICENSE.md
for details, or visit https://github.com/aantron/dream.
Copyright 2021 Anton Bachin *)moduleMessage=Dream_pure.Message(* TODO This middleware might need to be applied right in the h2 adapter,
because error handlers might generate headers that cannot be rewritten
inside the normal stack. *)(* TODO This can be optimized not to convert a header if it is already
lowercase. Another option is to use memoization to reduce GC pressure. *)letlowercase_headersinner_handlerrequest=let%lwtresponse=inner_handlerrequestiniffst(Message.versionrequest)<>1thenMessage.all_headersresponse|>List.map(fun(name,value)->String.lowercase_asciiname,value)|>Message.set_all_headersresponse;Lwt.returnresponse