mirror of
https://github.com/pgsty/minio.git
synced 2026-07-19 12:10:24 +03:00
api: DRY code and add new test
This commit makes code cleaner and reduces the repetitions in the code base. Specifically, it reduces the clutter in setObjectHeaders. It also merges encodeSuccessResponse and encodeErrorResponse together because they served no purpose differently. Finally, it adds a simple test for generateRequestID.
This commit is contained in:
+1
-1
@@ -436,7 +436,7 @@ func writeErrorResponse(w http.ResponseWriter, req *http.Request, errorType int,
|
||||
error := getErrorCode(errorType)
|
||||
// generate error response
|
||||
errorResponse := getErrorResponse(error, resource)
|
||||
encodedErrorResponse := encodeErrorResponse(errorResponse)
|
||||
encodedErrorResponse := encodeResponse(errorResponse)
|
||||
// set common headers
|
||||
setCommonHeaders(w)
|
||||
// write Header
|
||||
|
||||
Reference in New Issue
Block a user