Отвечать 400 и 401 вместо 500 на NUL и невалидный UTF-8 во входных данных
This commit is contained in:
@@ -396,7 +396,7 @@ func TestMessagesEndToEnd(t *testing.T) {
|
||||
first := ts.message(alice.token, room.ID, "Привет, мир 👋")
|
||||
second := ts.message(bob.token, room.ID, "Сообщение Боба")
|
||||
if first.SenderID != alice.ID || second.SenderID != bob.ID {
|
||||
t.Fatalf("sender must come from X-User-Id: %+v %+v", first, second)
|
||||
t.Fatalf("sender must come from the bearer token: %+v %+v", first, second)
|
||||
}
|
||||
if first.ChatID != room.ID || first.Text != "Привет, мир 👋" {
|
||||
t.Fatalf("message = %+v", first)
|
||||
|
||||
@@ -54,6 +54,8 @@ func TestLoginFailuresAreUniformBasicChallenges(t *testing.T) {
|
||||
"bearer scheme": {"Authorization": "Bearer " + strings.Repeat("A", 43)},
|
||||
"not base64": {"Authorization": "Basic !!!"},
|
||||
"no colon": {"Authorization": "Basic " + encoded("alice")},
|
||||
"nul username": basic("a\x00b", testPassword),
|
||||
"non-utf-8 name": basic("\xff\xfe", testPassword),
|
||||
}
|
||||
messages := map[string]string{}
|
||||
for name, headers := range cases {
|
||||
|
||||
Reference in New Issue
Block a user