Plugins: Refactor call resource API handling (#67234)

Moving call resource API stream handling within plugin management as a utility/wrapper. 

Closes #66889

Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
This commit is contained in:
Marcus Efraimsson
2023-04-28 14:02:27 +02:00
committed by GitHub
co-authored by Will Browne
parent b5fbce50b3
commit 4cbda914bd
6 changed files with 252 additions and 169 deletions
@@ -34,6 +34,10 @@ func (m *ResourceResponseMiddleware) CallResource(ctx context.Context, req *back
processedStreams := 0
wrappedSender := callResourceResponseSenderFunc(func(res *backend.CallResourceResponse) error {
if processedStreams == 0 {
if res.Headers == nil {
res.Headers = map[string][]string{}
}
proxyutil.SetProxyResponseHeaders(res.Headers)
}