aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2019-12-24 07:08:46 -0800
committerGitHub <noreply@github.com>2019-12-24 07:08:46 -0800
commit9114f7f432c8d8069856e54158f1f676a41fcf5f (patch)
tree1cdc80c1dc6bd8d117b062ba954f0843a7269c4b
parent409a3fe41f88ad276135fd3b0f0c84a9e46e78e5 (diff)
parentf87ccbddb4ceff69ae67a46143eb3a434487659b (diff)
downloadseaweedfs-9114f7f432c8d8069856e54158f1f676a41fcf5f.tar.xz
seaweedfs-9114f7f432c8d8069856e54158f1f676a41fcf5f.zip
Merge pull request #1169 from stlpmo-jn/http_304_has_no_resp_body
remove the http 304 response body
-rw-r--r--weed/server/volume_server_handlers_write.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/weed/server/volume_server_handlers_write.go b/weed/server/volume_server_handlers_write.go
index db8fcb555..05e21612b 100644
--- a/weed/server/volume_server_handlers_write.go
+++ b/weed/server/volume_server_handlers_write.go
@@ -51,10 +51,14 @@ func (vs *VolumeServer) PostHandler(w http.ResponseWriter, r *http.Request) {
ret := operation.UploadResult{}
_, isUnchanged, writeError := topology.ReplicatedWrite(vs.GetMaster(), vs.store, volumeId, needle, r)
- httpStatus := http.StatusCreated
- if isUnchanged {
- httpStatus = http.StatusNotModified
+
+ // http 304 status code does not allow body
+ if writeError == nil && isUnchanged {
+ w.WriteHeader(http.StatusNotModified)
+ return
}
+
+ httpStatus := http.StatusCreated
if writeError != nil {
httpStatus = http.StatusInternalServerError
ret.Error = writeError.Error()