api4/license: Return 400 instead of 501 if format is not passed (#19856)
```release-note NONE ``` Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
326daf1334
Коммит
1cc50ff90c
@@ -31,7 +31,7 @@ func getClientLicense(c *Context, w http.ResponseWriter, r *http.Request) {
|
|||||||
format := r.URL.Query().Get("format")
|
format := r.URL.Query().Get("format")
|
||||||
|
|
||||||
if format == "" {
|
if format == "" {
|
||||||
c.Err = model.NewAppError("getClientLicense", "api.license.client.old_format.app_error", nil, "", http.StatusNotImplemented)
|
c.Err = model.NewAppError("getClientLicense", "api.license.client.old_format.app_error", nil, "", http.StatusBadRequest)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ func TestGetOldClientLicense(t *testing.T) {
|
|||||||
|
|
||||||
resp, err := client.DoAPIGet("/license/client", "")
|
resp, err := client.DoAPIGet("/license/client", "")
|
||||||
require.Error(t, err, "get /license/client did not return an error")
|
require.Error(t, err, "get /license/client did not return an error")
|
||||||
require.Equal(t, http.StatusNotImplemented, resp.StatusCode,
|
require.Equal(t, http.StatusBadRequest, resp.StatusCode,
|
||||||
"expected 501 Not Implemented")
|
"expected 400 bad request")
|
||||||
|
|
||||||
resp, err = client.DoAPIGet("/license/client?format=junk", "")
|
resp, err = client.DoAPIGet("/license/client?format=junk", "")
|
||||||
require.Error(t, err, "get /license/client?format=junk did not return an error")
|
require.Error(t, err, "get /license/client?format=junk did not return an error")
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user