Title: Dynamic modules are unable to add response trailers if the incoming response has no trailers
Description:
In a dynamic module, calls to envoy_filter.set_response_trailer(...) fail (no trailer set, function returns false) if either the incoming response has no trailers to begin with (e.g. an http/1.1 response), or the call is made before trailer parsing has occurred (e.g. in on_response_body hook).
Repro steps:
- Set up a dynamic module filtering a request that is made with http/2 (e.g. grpc) but the upstream cluster responds with http/1.1
- in
on_response_body attempt to set a trailer
- see that the call returns
false and no trailers are set.
I'll set up a minimal repro when I get a chance, just noting the current state so I can link my PR to an issue