diff options
| author | Chris Lu <chris.lu@gmail.com> | 2019-08-09 14:38:54 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2019-08-09 14:38:54 -0700 |
| commit | 0dc43ecdcaa72e74cc46f667127d0e36fc3d2883 (patch) | |
| tree | 3bb5b820e08a7014a49813be28a85882b7f0369a | |
| parent | b9f6236f8ac4931f29747b6dd1d952dd541887ad (diff) | |
| download | seaweedfs-0dc43ecdcaa72e74cc46f667127d0e36fc3d2883.tar.xz seaweedfs-0dc43ecdcaa72e74cc46f667127d0e36fc3d2883.zip | |
skip writing content if not modified
related to https://github.com/chrislusf/seaweedfs/issues/1036
| -rw-r--r-- | weed/server/common.go | 6 |
1 files changed, 6 insertions, 0 deletions
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 } |
