WithInput You can send input data by using WithInput(). They will be sent as a cookie. This method can send form, multipart form, query data to redirected route. You can get them by using: Redirect().OldInputs(), Redirect().OldInput()
()
| 192 | // This method can send form, multipart form, query data to redirected route. |
| 193 | // You can get them by using: Redirect().OldInputs(), Redirect().OldInput() |
| 194 | func (r *Redirect) WithInput() *Redirect { |
| 195 | // Get content-type |
| 196 | ctype := utils.UnsafeString(utilsbytes.UnsafeToLower(r.c.RequestCtx().Request.Header.ContentType())) |
| 197 | ctype = binder.FilterFlags(utils.ParseVendorSpecificContentType(ctype)) |
| 198 | |
| 199 | oldInput := acquireOldInput() |
| 200 | defer releaseOldInput(oldInput) |
| 201 | |
| 202 | switch ctype { |
| 203 | case MIMEApplicationForm, MIMEMultipartForm: |
| 204 | _ = r.c.Bind().Form(oldInput) //nolint:errcheck // not needed |
| 205 | default: |
| 206 | _ = r.c.Bind().Query(oldInput) //nolint:errcheck // not needed |
| 207 | } |
| 208 | |
| 209 | // Add old input data |
| 210 | for k, v := range oldInput { |
| 211 | r.messages = append(r.messages, redirectionMsg{ |
| 212 | key: k, |
| 213 | value: v, |
| 214 | isOldInput: true, |
| 215 | }) |
| 216 | } |
| 217 | |
| 218 | return r |
| 219 | } |
| 220 | |
| 221 | // Messages Get flash messages. |
| 222 | func (r *Redirect) Messages() []FlashMessage { |