aboutsummaryrefslogtreecommitdiff
path: root/weed/s3api/s3api_handlers.go
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2020-06-11 10:37:19 -0700
committerGitHub <noreply@github.com>2020-06-11 10:37:19 -0700
commit63a1db64c5eaf80739163ead31f168d9c634edb6 (patch)
treeee171507f99a0bdb358d02c1e2fb2cad1a8ee45b /weed/s3api/s3api_handlers.go
parent628b27ef3b4cf8c1c894430e0d40b0bc1de8ba96 (diff)
parent283b749ff1af05cfb60df614b1710bfc021b425d (diff)
downloadseaweedfs-63a1db64c5eaf80739163ead31f168d9c634edb6.tar.xz
seaweedfs-63a1db64c5eaf80739163ead31f168d9c634edb6.zip
Merge pull request #1358 from DXist/s3fixes
Return NotSuchKey error code for bucket S3 DeleteObject method
Diffstat (limited to 'weed/s3api/s3api_handlers.go')
-rw-r--r--weed/s3api/s3api_handlers.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/weed/s3api/s3api_handlers.go b/weed/s3api/s3api_handlers.go
index 45a7cbc2e..7ef676400 100644
--- a/weed/s3api/s3api_handlers.go
+++ b/weed/s3api/s3api_handlers.go
@@ -7,6 +7,7 @@ import (
"fmt"
"net/http"
"net/url"
+ "strconv"
"time"
"google.golang.org/grpc"
@@ -76,13 +77,19 @@ func getRESTErrorResponse(err APIError, resource string) RESTErrorResponse {
func writeResponse(w http.ResponseWriter, statusCode int, response []byte, mType mimeType) {
setCommonHeaders(w)
+ if response != nil {
+ w.Header().Set("Content-Length", strconv.Itoa(len(response)))
+ }
if mType != mimeNone {
w.Header().Set("Content-Type", string(mType))
}
w.WriteHeader(statusCode)
if response != nil {
glog.V(4).Infof("status %d %s: %s", statusCode, mType, string(response))
- w.Write(response)
+ _, err := w.Write(response)
+ if err != nil {
+ glog.V(0).Infof("write err: %v", err)
+ }
w.(http.Flusher).Flush()
}
}