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

Function valuesFromForm

middleware/extractor.go:235–253  ·  view source on GitHub ↗

valuesFromForm returns a function that extracts values from the form field.

(name string, limit uint)

Source from the content-addressed store, hash-verified

233
234// valuesFromForm returns a function that extracts values from the form field.
235func valuesFromForm(name string, limit uint) ValuesExtractor {
236 if limit == 0 {
237 limit = 1
238 }
239 return func(c *echo.Context) ([]string, ExtractorSource, error) {
240 if c.Request().Form == nil {
241 _, _ = c.MultipartForm() // we want to trigger c.request.ParseMultipartForm(c.formParseMaxMemory)
242 }
243 values := c.Request().Form[name]
244 if len(values) == 0 {
245 return nil, ExtractorSourceForm, errFormExtractorValueMissing
246 }
247 if len(values) > int(limit)-1 {
248 values = values[:limit]
249 }
250 result := append([]string{}, values...)
251 return result, ExtractorSourceForm, nil
252 }
253}

Callers 2

createExtractorsFunction · 0.85
TestValuesFromFormFunction · 0.85

Calls 2

RequestMethod · 0.80
MultipartFormMethod · 0.80

Tested by 1

TestValuesFromFormFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…