mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 23:00:55 +03:00
httpd: webpath redirect using status found (302)
301 MovedPermanently is cached by the browser which can be annoying when it is is on base path like / while one may reuse the domain (e.g. localhost) for other apps/tests. Fixes #695 Signed-off-by: Jeremy Clerc <jeremy@clerc.io>
This commit is contained in:
committed by
Nicola Murino
parent
d2a4178846
commit
9709aed5e6
@@ -1649,14 +1649,14 @@ func TestWebAdminRedirect(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
rr := httptest.NewRecorder()
|
||||
testServer.Config.Handler.ServeHTTP(rr, req)
|
||||
assert.Equal(t, http.StatusMovedPermanently, rr.Code, rr.Body.String())
|
||||
assert.Equal(t, http.StatusFound, rr.Code, rr.Body.String())
|
||||
assert.Equal(t, webLoginPath, rr.Header().Get("Location"))
|
||||
|
||||
req, err = http.NewRequest(http.MethodGet, webBasePath, nil)
|
||||
assert.NoError(t, err)
|
||||
rr = httptest.NewRecorder()
|
||||
testServer.Config.Handler.ServeHTTP(rr, req)
|
||||
assert.Equal(t, http.StatusMovedPermanently, rr.Code, rr.Body.String())
|
||||
assert.Equal(t, http.StatusFound, rr.Code, rr.Body.String())
|
||||
assert.Equal(t, webLoginPath, rr.Header().Get("Location"))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user