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

Function FromQuery

extractors/extractors.go:383–395  ·  view source on GitHub ↗

FromQuery creates an Extractor that retrieves a value from a specified query parameter in the request. Query parameters are extracted from the URL query string (e.g., ?key=value&foo=bar). SECURITY WARNING: Extracting values from URL query parameters can leak sensitive information through: - Server

(param string)

Source from the content-addressed store, hash-verified

381// // URL: /api/data?token=abc123&format=json -> Output: "abc123"
382// // URL: /api/data?format=json -> Output: ErrNotFound
383func FromQuery(param string) Extractor {
384 return Extractor{
385 Extract: func(c fiber.Ctx) (string, error) {
386 value := c.Query(param)
387 if value == "" {
388 return "", ErrNotFound
389 }
390 return value, nil
391 },
392 Key: param,
393 Source: SourceQuery,
394 }
395}
396
397// FromCustom creates an Extractor using a provided function.
398// This allows for custom extraction logic beyond the built-in extractors.

Calls 1

QueryMethod · 0.65