Skip to content

Commit 16a2f54

Browse files
authored
Add response compression wrapper for query api (cortexproject#6844)
* add response compression wrapper to query api Signed-off-by: Ahmed Hassan <afayekhassan@gmail.com> * fix formatting Signed-off-by: Ahmed Hassan <afayekhassan@gmail.com> --------- Signed-off-by: Ahmed Hassan <afayekhassan@gmail.com>
1 parent 7640265 commit 16a2f54

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/api/queryapi/query_api.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ func (q *QueryAPI) InstantQueryHandler(r *http.Request) (result apiFuncResult) {
188188
}
189189

190190
func (q *QueryAPI) Wrap(f apiFunc) http.HandlerFunc {
191-
return func(w http.ResponseWriter, r *http.Request) {
191+
hf := func(w http.ResponseWriter, r *http.Request) {
192192
httputil.SetCORS(w, q.CORSOrigin, r)
193193

194194
result := f(r)
@@ -207,6 +207,10 @@ func (q *QueryAPI) Wrap(f apiFunc) http.HandlerFunc {
207207
}
208208
w.WriteHeader(http.StatusNoContent)
209209
}
210+
211+
return httputil.CompressionHandler{
212+
Handler: http.HandlerFunc(hf),
213+
}.ServeHTTP
210214
}
211215

212216
func (q *QueryAPI) respond(w http.ResponseWriter, req *http.Request, data interface{}, warnings annotations.Annotations, query string) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy