diff --git a/lib/builder_web.ml b/lib/builder_web.ml index c8460f1..848ee24 100644 --- a/lib/builder_web.ml +++ b/lib/builder_web.ml @@ -797,7 +797,19 @@ let error_template error _debug_info suggested_response = in Dream.set_header suggested_response "Content-Type" Dream.text_html; Dream.set_body suggested_response @@ string_of_html html; - Lwt.return suggested_response + (* NOTE: this does the same job as the dream-encoding middleware; + the middleware is not triggered in error templates *) + let preferred_algorithm = + Option.bind error.request + Dream_encoding.preferred_content_encoding + in + begin match preferred_algorithm with + | Some algorithm -> + let+ body = Dream.body suggested_response in + Dream_encoding.with_encoded_body body ~algorithm suggested_response + | None -> + Lwt.return suggested_response + end | _ -> Lwt.return suggested_response diff --git a/lib/dune b/lib/dune index 9418899..ff25562 100644 --- a/lib/dune +++ b/lib/dune @@ -2,4 +2,4 @@ (name builder_web) (libraries builder builder_db dream tyxml bos duration ohex caqti-lwt opamdiff ptime.clock.os cmarkit tar tar.gz tar-unix owee solo5-elftool decompress.de - decompress.gz uri digestif)) + decompress.gz uri digestif dream-encoding))