Add delete handlers and reply back as 'NotImplemented' instead of 404

master
Harshavardhana 10 years ago
parent 69366e20d3
commit 8efc842b59
  1. 25
      pkg/api/api_object_handlers.go
  2. 6
      pkg/api/api_router.go

@ -173,10 +173,6 @@ func (server *minioAPI) putObjectHandler(w http.ResponseWriter, req *http.Reques
// as the minimum limit, they do not seem to enforce it one can successfully
// create a 0byte file using a regular putObject() operation
//
// For example take a look at :-
//
// $ mc ls https://s3.amazonaws.com/ferenginar/test.go
//
// if isMinObjectSize(size) {
// writeErrorResponse(w, req, EntityTooSmall, acceptsContentType, req.URL.Path)
// return
@ -218,6 +214,9 @@ func (server *minioAPI) putObjectHandler(w http.ResponseWriter, req *http.Reques
}
}
/// Multipart API
// New multipart upload
func (server *minioAPI) newMultipartUploadHandler(w http.ResponseWriter, req *http.Request) {
acceptsContentType := getContentType(req)
// handle ACL's here at bucket level
@ -257,6 +256,7 @@ func (server *minioAPI) newMultipartUploadHandler(w http.ResponseWriter, req *ht
}
}
// Upload part
func (server *minioAPI) putObjectPartHandler(w http.ResponseWriter, req *http.Request) {
acceptsContentType := getContentType(req)
// handle ACL's here at bucket level
@ -337,6 +337,7 @@ func (server *minioAPI) putObjectPartHandler(w http.ResponseWriter, req *http.Re
}
}
// Abort multipart upload
func (server *minioAPI) abortMultipartUploadHandler(w http.ResponseWriter, req *http.Request) {
acceptsContentType := getContentType(req)
// handle ACL's here at bucket level
@ -369,6 +370,7 @@ func (server *minioAPI) abortMultipartUploadHandler(w http.ResponseWriter, req *
}
}
// List object parts
func (server *minioAPI) listObjectPartsHandler(w http.ResponseWriter, req *http.Request) {
acceptsContentType := getContentType(req)
// handle ACL's here at bucket level
@ -408,6 +410,7 @@ func (server *minioAPI) listObjectPartsHandler(w http.ResponseWriter, req *http.
}
}
// Complete multipart upload
func (server *minioAPI) completeMultipartUploadHandler(w http.ResponseWriter, req *http.Request) {
acceptsContentType := getContentType(req)
// handle ACL's here at bucket level
@ -460,3 +463,17 @@ func (server *minioAPI) completeMultipartUploadHandler(w http.ResponseWriter, re
}
}
}
/// Delete API
// Delete bucket
func (server *minioAPI) deleteBucketHandler(w http.ResponseWriter, req *http.Request) {
error := getErrorCode(NotImplemented)
w.WriteHeader(error.HTTPStatusCode)
}
// Delete object
func (server *minioAPI) deleteObjectHandler(w http.ResponseWriter, req *http.Request) {
error := getErrorCode(NotImplemented)
w.WriteHeader(error.HTTPStatusCode)
}

@ -65,6 +65,12 @@ func HTTPHandler(config Config) http.Handler {
mux.HandleFunc("/{bucket}/{object:.*}", api.getObjectHandler).Methods("GET")
mux.HandleFunc("/{bucket}/{object:.*}", api.putObjectHandler).Methods("PUT")
// not implemented yet
mux.HandleFunc("/{bucket}", api.deleteBucketHandler).Methods("DELETE")
// unsupported API
mux.HandleFunc("/{bucket}/{object:.*}", api.deleteObjectHandler).Methods("DELETE")
handler := validContentTypeHandler(mux)
handler = timeValidityHandler(handler)
handler = ignoreResourcesHandler(handler)

Loading…
Cancel
Save