ErrorExcessParams checks if any query params were passed in that were not parsed. If so, it adds an error to the parser as these values are not valid query parameters.
(values url.Values)
| 43 | // parsed. If so, it adds an error to the parser as these values are not valid |
| 44 | // query parameters. |
| 45 | func (p *QueryParamParser) ErrorExcessParams(values url.Values) { |
| 46 | for k := range values { |
| 47 | if _, ok := p.Parsed[k]; !ok { |
| 48 | p.Errors = append(p.Errors, codersdk.ValidationError{ |
| 49 | Field: k, |
| 50 | Detail: fmt.Sprintf("%q is not a valid query param", k), |
| 51 | }) |
| 52 | } |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | func (p *QueryParamParser) addParsed(key string) { |
| 57 | p.Parsed[key] = true |
no outgoing calls
no test coverage detected