mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
parent
e03ebfd13b
commit
5b29cefd40
@ -936,10 +936,9 @@ func (api objectAPIHandlers) DeleteObjectHandler(w http.ResponseWriter, r *http.
|
||||
return
|
||||
}
|
||||
}
|
||||
if err := api.ObjectAPI.DeleteObject(bucket, object); err != nil {
|
||||
errorIf(err, "DeleteObject failed.", nil)
|
||||
writeErrorResponse(w, r, toAPIErrorCode(err), r.URL.Path)
|
||||
return
|
||||
}
|
||||
/// http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectDELETE.html
|
||||
/// Ignore delete object errors, since we are suppposed to reply
|
||||
/// only 204.
|
||||
api.ObjectAPI.DeleteObject(bucket, object)
|
||||
writeSuccessNoContent(w)
|
||||
}
|
||||
|
@ -351,6 +351,7 @@ func (s *MyAPISuite) TestDeleteBucketNotEmpty(c *C) {
|
||||
c.Assert(response.StatusCode, Equals, http.StatusConflict)
|
||||
}
|
||||
|
||||
// Tests delete object responses and success.
|
||||
func (s *MyAPISuite) TestDeleteObject(c *C) {
|
||||
request, err := s.newRequest("PUT", testAPIFSCacheServer.URL+"/deletebucketobject", 0, nil)
|
||||
c.Assert(err, IsNil)
|
||||
@ -374,6 +375,14 @@ func (s *MyAPISuite) TestDeleteObject(c *C) {
|
||||
response, err = client.Do(request)
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(response.StatusCode, Equals, http.StatusNoContent)
|
||||
|
||||
// Delete non existant object should return http.StatusNoContent.
|
||||
request, err = s.newRequest("DELETE", testAPIFSCacheServer.URL+"/deletebucketobject/myobject1", 0, nil)
|
||||
c.Assert(err, IsNil)
|
||||
client = http.Client{}
|
||||
response, err = client.Do(request)
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(response.StatusCode, Equals, http.StatusNoContent)
|
||||
}
|
||||
|
||||
func (s *MyAPISuite) TestNonExistantBucket(c *C) {
|
||||
|
Loading…
Reference in New Issue
Block a user