Отвечать 400 и 401 вместо 500 на NUL и невалидный UTF-8 во входных данных
This commit is contained in:
@@ -28,7 +28,7 @@ func TestNewMessageValidatesTextByCodePoints(t *testing.T) {
|
||||
if _, err := chat.NewMessage(ident.New(), chatID, alice, strings.Repeat("я", 4000)); err != nil {
|
||||
t.Errorf("4000 code points must be accepted: %v", err)
|
||||
}
|
||||
for _, text := range []string{"", " ", "\n\t ", strings.Repeat("я", 4001)} {
|
||||
for _, text := range []string{"", " ", "\n\t ", strings.Repeat("я", 4001), "nul\x00inside"} {
|
||||
_, err := chat.NewMessage(ident.New(), chatID, alice, text)
|
||||
if apperr.KindOf(err) != apperr.KindInvalid {
|
||||
t.Errorf("text %q must be rejected as invalid, got %v", text, err)
|
||||
|
||||
Reference in New Issue
Block a user