From eac518b178a891e33bc559318d1ee682b9b85473 Mon Sep 17 00:00:00 2001 From: Andreas Auernhammer Date: Thu, 31 Oct 2019 07:41:18 +0100 Subject: [PATCH] admin API: change returned HTTP error in hardware info (#8471) This commit replaces the returned error message by the hardware info handler from `Method-Not-Allowed` to `Bad-Request` since the current HTTP error is not correct according to the HTTP spec. In particular: ``` The origin server MUST generate an Allow header field in a 405 response containing a list of the target resource's currently supported methods. ``` From: https://tools.ietf.org/html/rfc7231#section-6.5.5 --- cmd/admin-handlers.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/admin-handlers.go b/cmd/admin-handlers.go index a067e6b1e..2f249fcd1 100644 --- a/cmd/admin-handlers.go +++ b/cmd/admin-handlers.go @@ -1761,6 +1761,6 @@ func (a adminAPIHandlers) ServerHardwareInfoHandler(w http.ResponseWriter, r *ht writeSuccessResponseJSON(w, jsonBytes) default: - writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(ErrMethodNotAllowed), r.URL) + writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(ErrBadRequest), r.URL) } }