ParseForm process form
(c *Core, ctx *gin.Context)
| 95 | |
| 96 | // ParseForm process form |
| 97 | func (m *MsgParam) ParseForm(c *Core, ctx *gin.Context) { |
| 98 | m.Text = ctx.PostForm("text") |
| 99 | if m.Token == nil { |
| 100 | m.Token, _ = c.parseToken(ctx.PostForm("token")) |
| 101 | } |
| 102 | if len(m.Link) <= 0 { |
| 103 | m.Link = ctx.PostForm("link") |
| 104 | } |
| 105 | if len(m.CopyText) <= 0 { |
| 106 | m.CopyText = ctx.PostForm("copy") |
| 107 | } |
| 108 | if len(m.AutoCopy) <= 0 { |
| 109 | m.AutoCopy = ctx.PostForm("autocopy") |
| 110 | } |
| 111 | if len(m.Sound) <= 0 { |
| 112 | m.Sound = ctx.PostForm("sound") |
| 113 | } |
| 114 | if len(m.Actions) <= 0 { |
| 115 | m.Actions = ctx.PostFormArray("action") |
| 116 | } |
| 117 | if m.Priority <= 0 { |
| 118 | m.Priority = parsePriority(ctx.PostForm("priority")) |
| 119 | } |
| 120 | if len(m.InterruptionLevel) <= 0 { |
| 121 | m.InterruptionLevel = ctx.PostForm("interruption-level") |
| 122 | } |
| 123 | if len(m.TimeContent.Code) <= 0 { |
| 124 | m.TimeContent.Code = ctx.PostForm("timeline-code") |
| 125 | m.TimeContent.Timestamp = parseTimestamp(ctx.PostForm("timeline-timestamp")) |
| 126 | m.TimeContent.Items = parseTimeContentStringItems(ctx.PostFormMap("timeline-items")) |
| 127 | } |
| 128 | } |
| 129 | |
| 130 | // ParseFormData process multipart/form-data |
| 131 | func (m *MsgParam) ParseFormData(c *Core, ctx *gin.Context) (*model.Message, error) { |
no test coverage detected