aboutsummaryrefslogtreecommitdiff
path: root/weed/s3api/s3api_handlers.go
diff options
context:
space:
mode:
authorRinat Shigapov <rinatshigapov@gmail.com>2020-06-11 17:53:15 +0300
committerRinat Shigapov <rinatshigapov@gmail.com>2020-06-11 17:53:15 +0300
commitfafc41a27fd3c5f6a4244729f94b68d690ec2482 (patch)
tree1dc2f7d285d437af878659749fcb20757c9750f3 /weed/s3api/s3api_handlers.go
parent2d2c5dfa39afeb4eafbbd8cb0a0f5628516bb4ee (diff)
downloadseaweedfs-fafc41a27fd3c5f6a4244729f94b68d690ec2482.tar.xz
seaweedfs-fafc41a27fd3c5f6a4244729f94b68d690ec2482.zip
return xml encoded NotFound status code for s3 delete
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()
}
}