1
0
Fork 0
forked from forgejo/forgejo

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

(cherry picked from commit 5fb3b927f1)
This commit is contained in:
oliverpool 2024-02-02 10:18:42 +01:00 committed by Earl Warren
parent 2ed825c5be
commit 76c2f5bf92
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
2 changed files with 88 additions and 0 deletions

View file

@ -516,6 +516,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