From 0dc43ecdcaa72e74cc46f667127d0e36fc3d2883 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Fri, 9 Aug 2019 14:38:54 -0700 Subject: [PATCH] skip writing content if not modified related to https://github.com/chrislusf/seaweedfs/issues/1036 --- weed/server/common.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/weed/server/common.go b/weed/server/common.go index e02ab38a6..d50c283f2 100644 --- a/weed/server/common.go +++ b/weed/server/common.go @@ -48,10 +48,16 @@ func writeJson(w http.ResponseWriter, r *http.Request, httpStatus int, obj inter if callback == "" { w.Header().Set("Content-Type", "application/json") w.WriteHeader(httpStatus) + if httpStatus == http.StatusNotModified { + return + } _, err = w.Write(bytes) } else { w.Header().Set("Content-Type", "application/javascript") w.WriteHeader(httpStatus) + if httpStatus == http.StatusNotModified { + return + } if _, err = w.Write([]uint8(callback)); err != nil { return }