Browse Source
Merge pull request #1169 from stlpmo-jn/http_304_has_no_resp_body
remove the http 304 response body
pull/1171/head
Chris Lu
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
7 additions and
3 deletions
-
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() |
|
|
|