httpd: add a test case for StripSlash middleware

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino 2023-10-08 10:46:17 +02:00
parent da0eb5037e
commit 63972edb96
No known key found for this signature in database
GPG key ID: 935D2952DEC4EECF

View file

@ -22881,6 +22881,12 @@ func TestNameParamSingleSlash(t *testing.T) {
groupGet, _, err := httpdtest.GetGroupByName(group.Name, http.StatusOK)
assert.NoError(t, err)
assert.Equal(t, "/", groupGet.Name)
// check strip slash
req, err = http.NewRequest(http.MethodGet, webGroupsPath+"/", nil)
assert.NoError(t, err)
setJWTCookieForReq(req, webToken)
rr = executeRequest(req)
checkResponseCode(t, http.StatusOK, rr)
// cleanup
req, err = http.NewRequest(http.MethodDelete, groupPath+"/"+url.PathEscape(group.Name), nil)
assert.NoError(t, err)