diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-09-19 14:09:58 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-09-19 14:09:58 -0700 |
| commit | 5b40a2690a9e24eb3911bbb8cf2454180887f90d (patch) | |
| tree | 0c96318716241e42c71b5930bf40f78a6503f687 /weed/s3api/s3api_handlers.go | |
| parent | 2c21eb19719d06a2fbf0b9e75cba46aa5e4e01c2 (diff) | |
| download | seaweedfs-5b40a2690a9e24eb3911bbb8cf2454180887f90d.tar.xz seaweedfs-5b40a2690a9e24eb3911bbb8cf2454180887f90d.zip | |
refactoring
Diffstat (limited to 'weed/s3api/s3api_handlers.go')
| -rw-r--r-- | weed/s3api/s3api_handlers.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/weed/s3api/s3api_handlers.go b/weed/s3api/s3api_handlers.go index 7ef676400..fa706cd1c 100644 --- a/weed/s3api/s3api_handlers.go +++ b/weed/s3api/s3api_handlers.go @@ -5,6 +5,7 @@ import ( "encoding/base64" "encoding/xml" "fmt" + "github.com/chrislusf/seaweedfs/weed/s3api/s3err" "net/http" "net/url" "strconv" @@ -56,18 +57,18 @@ func (s3a *S3ApiServer) AdjustedUrl(hostAndPort string) string { // If none of the http routes match respond with MethodNotAllowed func notFoundHandler(w http.ResponseWriter, r *http.Request) { glog.V(0).Infof("unsupported %s %s", r.Method, r.RequestURI) - writeErrorResponse(w, ErrMethodNotAllowed, r.URL) + writeErrorResponse(w, s3err.ErrMethodNotAllowed, r.URL) } -func writeErrorResponse(w http.ResponseWriter, errorCode ErrorCode, reqURL *url.URL) { - apiError := getAPIError(errorCode) +func writeErrorResponse(w http.ResponseWriter, errorCode s3err.ErrorCode, reqURL *url.URL) { + apiError := s3err.GetAPIError(errorCode) errorResponse := getRESTErrorResponse(apiError, reqURL.Path) encodedErrorResponse := encodeResponse(errorResponse) writeResponse(w, apiError.HTTPStatusCode, encodedErrorResponse, mimeXML) } -func getRESTErrorResponse(err APIError, resource string) RESTErrorResponse { - return RESTErrorResponse{ +func getRESTErrorResponse(err s3err.APIError, resource string) s3err.RESTErrorResponse { + return s3err.RESTErrorResponse{ Code: err.Code, Message: err.Description, Resource: resource, |
