1
0
Fork 0
forked from forgejo/forgejo

[GITEA] add test showing bug on resolving invalidated review comment

This commit is contained in:
oliverpool 2024-02-02 10:18:42 +01:00
parent d56bb1bc95
commit d5bb14de66
2 changed files with 88 additions and 0 deletions

View file

@ -485,6 +485,24 @@ func logUnexpectedResponse(t testing.TB, recorder *httptest.ResponseRecorder) {
t.Helper()
respBytes := recorder.Body.Bytes()
if len(respBytes) == 0 {
// log the content of the flash cookie
for _, cookie := range recorder.Result().Cookies() {
if cookie.Name != gitea_context.CookieNameFlash {
continue
}
flash, _ := url.ParseQuery(cookie.Value)
for key, value := range flash {
// the key is itself url-encoded
if flash, err := url.ParseQuery(key); err == nil {
for key, value := range flash {
t.Logf("FlashCookie %q: %q", key, value)
}
} else {
t.Logf("FlashCookie %q: %q", key, value)
}
}
}
return
} else if len(respBytes) < 500 {
// if body is short, just log the whole thing