satellite/admin: Fix response code for Get bucket

Get bucket was returning a "bad request" HTTP status code when the
bucket doesn't exists.

We have to return HTTP "Not found" status code.

Change-Id: If717d99276b02a1e59a9b71ebc909bd6d8d9390b
This commit is contained in:
Ivan Fraixedes 2023-04-03 10:22:22 +02:00
parent 60444d145c
commit d17b41d027
No known key found for this signature in database
GPG Key ID: 042B474597F96DB7

View File

@ -116,7 +116,7 @@ func (server *Server) getBucketInfo(w http.ResponseWriter, r *http.Request) {
b, err := server.buckets.GetBucket(ctx, bucket, project.UUID)
if err != nil {
if storj.ErrBucketNotFound.Has(err) {
sendJSONError(w, "bucket does not exist", "", http.StatusBadRequest)
sendJSONError(w, "bucket does not exist", "", http.StatusNotFound)
} else {
sendJSONError(w, "unable to check bucket", err.Error(), http.StatusInternalServerError)
}