Отвечать 400 и 401 вместо 500 на NUL и невалидный UTF-8 во входных данных
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user