Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

skip writing content if not modified

Chris Lu0dc43ecdcaa7
diff --git a/weed/server/common.go b/weed/server/common.go
index e02ab38a69..d50c283f2c 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
}