Backend Plugins: Support handling of streaming resource response (#22580)
Use v0.19.0 of SDK. Support handling of streaming resource response. Disable gzip/compression middleware for resources to allow chunked/streaming response to clients the gzip middleware had to be disabled since it buffers the full response before sending it to the client. Closes #22569 Co-Authored-By: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
co-authored by
Arve Knudsen
parent
f95c8b785c
commit
4ff613a432
@@ -8,6 +8,8 @@ import (
|
||||
"gopkg.in/macaron.v1"
|
||||
)
|
||||
|
||||
const resourcesPath = "/resources"
|
||||
|
||||
func Gziper() macaron.Handler {
|
||||
gziperLogger := log.New("gziper")
|
||||
gziper := gzip.Gziper()
|
||||
@@ -27,6 +29,11 @@ func Gziper() macaron.Handler {
|
||||
return
|
||||
}
|
||||
|
||||
// ignore resources
|
||||
if (strings.HasPrefix(requestPath, "/api/datasources/") || strings.HasPrefix(requestPath, "/api/plugins/")) && strings.Contains(requestPath, resourcesPath) {
|
||||
return
|
||||
}
|
||||
|
||||
if _, err := ctx.Invoke(gziper); err != nil {
|
||||
gziperLogger.Error("Invoking gzip handler failed", "err", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user