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

Function FromForm

extractors/extractors.go:303–315  ·  view source on GitHub ↗

FromForm creates an Extractor that retrieves a value from a specified form field in the request. Form data is typically submitted via POST requests with content-type application/x-www-form-urlencoded. SECURITY WARNING: Extracting values from form data can leak sensitive information through: - Serve

(param string)

Source from the content-addressed store, hash-verified

301// // Form data: "username=john_doe&password=secret" -> Output: "john_doe"
302// // Missing field -> Output: ErrNotFound
303func FromForm(param string) Extractor {
304 return Extractor{
305 Extract: func(c fiber.Ctx) (string, error) {
306 value := c.FormValue(param)
307 if value == "" {
308 return "", ErrNotFound
309 }
310 return value, nil
311 },
312 Key: param,
313 Source: SourceForm,
314 }
315}
316
317// FromHeader creates an Extractor that retrieves a value from a specified HTTP header in the request.
318// HTTP headers are commonly used for API keys, tokens, and other metadata.

Calls 1

FormValueMethod · 0.65