Fix multival (string) requst param parsing (for POST)
This commit is contained in:
@@ -81,7 +81,9 @@ func (r *{name|expose}{call.name|capitalize}) Fill(req *http.Request) (err error
|
||||
r.{param.name|expose} = {if ($param.type !== "string")}{$parsers[$param.type]}({/if}chi.URLParam(req, "{param.name}"){if ($param.type !== "string")}){/if}
|
||||
{elseif (substr($param.type, 0, 2) === '[]' || substr($param.type, -3) === "Set") && isset($parsers[$param.type])}
|
||||
{if strtolower($method) === "post"}
|
||||
r.{param.name|expose} = {$parsers[$param.type]}(req.Form["{param.name}"])
|
||||
if val, ok := req.Form["{param.name}"]; ok {
|
||||
r.{param.name|expose} = {$parsers[$param.type]}(val)
|
||||
}
|
||||
{elseif strtolower($method) === "get"}
|
||||
if val, ok := urlQuery["{param.name}[]"]; ok {
|
||||
r.{param.name|expose} = {$parsers[$param.type]}(val)
|
||||
|
||||
@@ -84,9 +84,13 @@ func (r *NotificationEmailSend) Fill(req *http.Request) (err error) {
|
||||
post[name] = string(param[0])
|
||||
}
|
||||
|
||||
r.To = parseStrings(req.Form["to"])
|
||||
if val, ok := req.Form["to"]; ok {
|
||||
r.To = parseStrings(val)
|
||||
}
|
||||
|
||||
r.Cc = parseStrings(req.Form["cc"])
|
||||
if val, ok := req.Form["cc"]; ok {
|
||||
r.Cc = parseStrings(val)
|
||||
}
|
||||
|
||||
if val, ok := post["replyTo"]; ok {
|
||||
r.ReplyTo = val
|
||||
|
||||
@@ -430,7 +430,9 @@ func (r *PageReorder) Fill(req *http.Request) (err error) {
|
||||
r.SelfID = parseUInt64(chi.URLParam(req, "selfID"))
|
||||
r.NamespaceID = parseUInt64(chi.URLParam(req, "namespaceID"))
|
||||
|
||||
r.PageIDs = parseStrings(req.Form["pageIDs"])
|
||||
if val, ok := req.Form["pageIDs"]; ok {
|
||||
r.PageIDs = parseStrings(val)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -166,7 +166,9 @@ func (r *TriggerCreate) Fill(req *http.Request) (err error) {
|
||||
r.Name = val
|
||||
}
|
||||
|
||||
r.Actions = parseStrings(req.Form["actions"])
|
||||
if val, ok := req.Form["actions"]; ok {
|
||||
r.Actions = parseStrings(val)
|
||||
}
|
||||
|
||||
if val, ok := post["enabled"]; ok {
|
||||
r.Enabled = parseBool(val)
|
||||
@@ -306,7 +308,9 @@ func (r *TriggerUpdate) Fill(req *http.Request) (err error) {
|
||||
r.Name = val
|
||||
}
|
||||
|
||||
r.Actions = parseStrings(req.Form["actions"])
|
||||
if val, ok := req.Form["actions"]; ok {
|
||||
r.Actions = parseStrings(val)
|
||||
}
|
||||
|
||||
if val, ok := post["enabled"]; ok {
|
||||
r.Enabled = parseBool(val)
|
||||
|
||||
@@ -143,7 +143,9 @@ func (r *ChannelCreate) Fill(req *http.Request) (err error) {
|
||||
r.Type = val
|
||||
}
|
||||
|
||||
r.Members = parseStrings(req.Form["members"])
|
||||
if val, ok := req.Form["members"]; ok {
|
||||
r.Members = parseStrings(val)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -642,7 +644,9 @@ func (r *ChannelInvite) Fill(req *http.Request) (err error) {
|
||||
|
||||
r.ChannelID = parseUInt64(chi.URLParam(req, "channelID"))
|
||||
|
||||
r.UserID = parseStrings(req.Form["userID"])
|
||||
if val, ok := req.Form["userID"]; ok {
|
||||
r.UserID = parseStrings(val)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -143,7 +143,9 @@ func (r *MessageExecuteCommand) Fill(req *http.Request) (err error) {
|
||||
r.Input = val
|
||||
}
|
||||
|
||||
r.Params = parseStrings(req.Form["params"])
|
||||
if val, ok := req.Form["params"]; ok {
|
||||
r.Params = parseStrings(val)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -133,7 +133,9 @@ func (r *RoleCreate) Fill(req *http.Request) (err error) {
|
||||
r.Name = val
|
||||
}
|
||||
|
||||
r.Members = parseStrings(req.Form["members"])
|
||||
if val, ok := req.Form["members"]; ok {
|
||||
r.Members = parseStrings(val)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
@@ -193,7 +195,9 @@ func (r *RoleUpdate) Fill(req *http.Request) (err error) {
|
||||
r.Name = val
|
||||
}
|
||||
|
||||
r.Members = parseStrings(req.Form["members"])
|
||||
if val, ok := req.Form["members"]; ok {
|
||||
r.Members = parseStrings(val)
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user