Отвечать 400 и 401 вместо 500 на NUL и невалидный UTF-8 во входных данных

This commit is contained in:
2026-10-06 15:41:36 +03:00
parent 8f9252a5c1
commit 3001507ecb
10 changed files with 34 additions and 5 deletions
+3 -1
View File
@@ -23,7 +23,9 @@ func TestNewChatDerivesCreatedAtFromID(t *testing.T) {
}
func TestNewChatValidatesTitle(t *testing.T) {
for _, title := range []string{"", " ", strings.Repeat("я", 101)} {
// PostgreSQL text cannot hold U+0000, so a title with it is invalid input,
// not a storage failure.
for _, title := range []string{"", " ", strings.Repeat("я", 101), "nul\x00inside"} {
_, err := chat.NewChat(ident.New(), title)
if apperr.KindOf(err) != apperr.KindInvalid {
t.Errorf("title %q must be rejected as invalid, got %v", title, err)