Prevent HEAD requests to a sub-path from infinite redirects (#28285)
* adding test ```release-note NONE ``` --------- Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in> Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
3ac1c9821b
Коммит
e0e5dbd36e
@@ -400,6 +400,14 @@ func TestStaticFilesCaching(t *testing.T) {
|
||||
require.Equal(t, fakeRootHTML, res.Body.String())
|
||||
require.Equal(t, []string{"no-cache, max-age=31556926, public"}, res.Result().Header[http.CanonicalHeaderKey("Cache-Control")])
|
||||
|
||||
// Checking for HEAD method as well.
|
||||
req, _ = http.NewRequest(http.MethodHead, "/", nil)
|
||||
res = httptest.NewRecorder()
|
||||
th.Web.MainRouter.ServeHTTP(res, req)
|
||||
require.Equal(t, http.StatusOK, res.Code)
|
||||
require.Equal(t, fakeRootHTML, res.Body.String())
|
||||
require.Equal(t, []string{"no-cache, max-age=31556926, public"}, res.Result().Header[http.CanonicalHeaderKey("Cache-Control")])
|
||||
|
||||
req, _ = http.NewRequest("GET", "/static/"+fakeMainBundleName, nil)
|
||||
res = httptest.NewRecorder()
|
||||
th.Web.MainRouter.ServeHTTP(res, req)
|
||||
|
||||
Ссылка в новой задаче
Block a user