wilfred-s commented on code in PR #757:
URL: https://github.com/apache/yunikorn-core/pull/757#discussion_r1430919051
##########
pkg/webservice/handlers.go:
##########
@@ -614,6 +616,33 @@ func getQueueApplications(w http.ResponseWriter, r
*http.Request) {
appsDao = append(appsDao, getApplicationDAO(app))
}
+ if strings.Contains(r.Header.Get("Accept-Encoding"), "gzip") {
Review Comment:
By modular I mean create two functions. One that tests for the header
content see other review point and one that does all the compress work and
takes two parameters and returns nothing. We can use that compress function
anywhere.
```
func checkHeader(h http.Header, key, value string) bool
func compress(w http.ResponseWriter, v any)
```
Need to file a follow up jira when we add this to add support for all REST
endpoints to support compressed data...
##########
pkg/webservice/handlers.go:
##########
@@ -614,6 +616,33 @@ func getQueueApplications(w http.ResponseWriter, r
*http.Request) {
appsDao = append(appsDao, getApplicationDAO(app))
}
+ if strings.Contains(r.Header.Get("Accept-Encoding"), "gzip") {
Review Comment:
Testing for `gzip` as we do now is broken. The header is an array of strings
and `get` only returns the first value. So if I call the URL from the browser
it depends on the browser if `gzip` is the first in the list. We should use
this:
```
func checkHeader(h map[string][]string, key, value string) bool {
values := h.Values(key)
for _, v := range values {
if v == value {
return true
}
}
return false
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]