fix(server-go): 巡检 roomId UUID 校验(400);文档更新
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package handler
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestIsUUID(t *testing.T) {
|
||||
valid := []string{
|
||||
"1271e550-ccf1-443e-8964-980c6047e2f0",
|
||||
"00000000-0000-0000-0000-000000000000",
|
||||
}
|
||||
invalid := []string{"smoke-room", "", "not-a-uuid", "1271e550ccf1443e8964980c6047e2f0"}
|
||||
for _, s := range valid {
|
||||
if !isUUID(s) {
|
||||
t.Errorf("%q 应为合法 UUID", s)
|
||||
}
|
||||
}
|
||||
for _, s := range invalid {
|
||||
if isUUID(s) {
|
||||
t.Errorf("%q 不应被当作 UUID", s)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user