diff options
| author | Chris Lu <chris.lu@gmail.com> | 2021-06-10 16:54:36 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2021-06-10 16:54:36 -0700 |
| commit | 33b87244ef99a9651e6564b6cd517e824e35ed70 (patch) | |
| tree | a79e8203164f5aec6407e85386c4eee285ccd8f0 /weed/s3api/s3api_handlers.go | |
| parent | 40a8cb9b0a10c91fc69a35fac4c9154a4842aa4a (diff) | |
| download | seaweedfs-33b87244ef99a9651e6564b6cd517e824e35ed70.tar.xz seaweedfs-33b87244ef99a9651e6564b6cd517e824e35ed70.zip | |
refactoring
Diffstat (limited to 'weed/s3api/s3api_handlers.go')
| -rw-r--r-- | weed/s3api/s3api_handlers.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/weed/s3api/s3api_handlers.go b/weed/s3api/s3api_handlers.go index 6935c75bd..3df30ae22 100644 --- a/weed/s3api/s3api_handlers.go +++ b/weed/s3api/s3api_handlers.go @@ -7,7 +7,6 @@ import ( "fmt" "github.com/chrislusf/seaweedfs/weed/s3api/s3err" "net/http" - "net/url" "strconv" "time" @@ -57,12 +56,12 @@ func (s3a *S3ApiServer) AdjustedUrl(location *filer_pb.Location) 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, s3err.ErrMethodNotAllowed, r.URL) + writeErrorResponse(w, s3err.ErrMethodNotAllowed, r) } -func writeErrorResponse(w http.ResponseWriter, errorCode s3err.ErrorCode, reqURL *url.URL) { +func writeErrorResponse(w http.ResponseWriter, errorCode s3err.ErrorCode, r *http.Request) { apiError := s3err.GetAPIError(errorCode) - errorResponse := getRESTErrorResponse(apiError, reqURL.Path) + errorResponse := getRESTErrorResponse(apiError, r.URL.Path) encodedErrorResponse := encodeResponse(errorResponse) writeResponse(w, apiError.HTTPStatusCode, encodedErrorResponse, mimeXML) } |
