1234567891011121314151617181920212223242526(* 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 *)moduleDream=Dream__pure.Inmost(* 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=iffst(Dream.versionrequest)=1theninner_handlerrequestelselet%lwtresponse=inner_handlerrequestinresponse|>Dream.all_headers|>List.map(fun(name,value)->String.lowercase_asciiname,value)|>funheaders->Dream.with_all_headersheadersresponse|>Lwt.return