targetoee commented on code in PR #757:
URL: https://github.com/apache/yunikorn-core/pull/757#discussion_r1540385332
##########
pkg/webservice/handlers.go:
##########
@@ -1216,3 +1227,53 @@ func getStream(w http.ResponseWriter, r *http.Request) {
}
}
}
+
+func checkHeader(h http.Header, key string, value string) bool {
+ values := h.Values(key)
+ for _, v := range values {
+ v2 := strings.Split(v, ",")
+ for _, item := range v2 {
+ item = strings.TrimSpace(item)
+ if item == value {
+ return true
+ }
+ }
+ }
+ return false
+}
+
+func compress(w http.ResponseWriter, data any) {
+ response, err := json.Marshal(data)
+ if err != nil {
+ buildJSONErrorResponse(w, err.Error(),
http.StatusInternalServerError)
+ return
+ }
+
+ // don't compress the data if it is smaller than MTU size
+ if len(response) < 1500 {
Review Comment:
Thanks for pointing out the defect and that's really helpful. I've changed
it and still adjust the function.
--
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]