MCPcopy
hub / github.com/gofiber/fiber / WithInput

Method WithInput

redirect.go:194–219  ·  view source on GitHub ↗

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()

()

Source from the content-addressed store, hash-verified

192// This method can send form, multipart form, query data to redirected route.
193// You can get them by using: Redirect().OldInputs(), Redirect().OldInput()
194func (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.
222func (r *Redirect) Messages() []FlashMessage {

Calls 7

FilterFlagsFunction · 0.92
acquireOldInputFunction · 0.85
releaseOldInputFunction · 0.85
FormMethod · 0.80
RequestCtxMethod · 0.65
BindMethod · 0.65
QueryMethod · 0.65