diff options
| author | stlpmo <hq-STLPMO@chinaunicom.cn> | 2019-12-24 17:56:50 +0800 |
|---|---|---|
| committer | stlpmo <hq-STLPMO@chinaunicom.cn> | 2019-12-24 17:56:50 +0800 |
| commit | f87ccbddb4ceff69ae67a46143eb3a434487659b (patch) | |
| tree | 083c3a5ad44cdb85684b743f8e8cae3e38bcb339 | |
| parent | a18f62bbe7e5e477fd891849b44ec5a25d8988d2 (diff) | |
| download | seaweedfs-f87ccbddb4ceff69ae67a46143eb3a434487659b.tar.xz seaweedfs-f87ccbddb4ceff69ae67a46143eb3a434487659b.zip | |
remove the http 304 response body
| -rw-r--r-- | weed/server/volume_server_handlers_write.go | 10 |
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() |
