Allow SyTest's 30createroom test to pass

Dendrite was requiring "preset" as a parameter to createroom when it's
not a required field.
This commit is contained in:
Andrew Morgan 2018-05-24 13:50:50 +01:00
parent ed388a32b7
commit f5e94f0e95

View file

@ -87,13 +87,17 @@ func (r createRoomRequest) Validate() *util.JSONResponse {
} }
} }
} }
switch r.Preset {
case presetPrivateChat, presetTrustedPrivateChat, presetPublicChat: // If set, ensure r.Preset is one of allowed types
break if r.Preset != "" {
default: switch r.Preset {
return &util.JSONResponse{ case presetPrivateChat, presetTrustedPrivateChat, presetPublicChat:
Code: http.StatusBadRequest, break
JSON: jsonerror.BadJSON("preset must be any of 'private_chat', 'trusted_private_chat', 'public_chat'"), default:
return &util.JSONResponse{
Code: http.StatusBadRequest,
JSON: jsonerror.BadJSON("preset must be any of 'private_chat', 'trusted_private_chat', 'public_chat'"),
}
} }
} }