MCPcopy Index your code
hub / github.com/labstack/echo / getRawQueryParam

Function getRawQueryParam

context.go:351–370  ·  view source on GitHub ↗

getRawQueryParam returns the first value for name parsed directly from a raw URL query string. It matches url.Values.Get over url.ParseQuery output: first match wins, '+' decodes to space, percent escapes are decoded, segments containing ';' are skipped, and pairs whose key or value fail to unescape

(query, name string)

Source from the content-addressed store, hash-verified

349// escapes are decoded, segments containing ';' are skipped, and pairs whose key or value fail to
350// unescape are skipped. It avoids allocating the full url.Values map for single-key lookups.
351func getRawQueryParam(query, name string) string {
352 for query != "" {
353 var seg string
354 seg, query, _ = strings.Cut(query, "&")
355 if seg == "" || strings.Contains(seg, ";") {
356 continue
357 }
358 key, value, _ := strings.Cut(seg, "=")
359 k, err := url.QueryUnescape(key)
360 if err != nil || k != name {
361 continue
362 }
363 v, err := url.QueryUnescape(value)
364 if err != nil {
365 continue
366 }
367 return v
368 }
369 return ""
370}
371
372// QueryParamOr returns the query param or default value for the provided name.
373// Note: QueryParamOr does not distinguish if query had no value by that name or value was empty string

Callers 3

QueryParamMethod · 0.85

Calls

no outgoing calls

Tested by 2

Used in the wild real call sites across dependent graphs

searching dependent graphs…