(r *http.Request, dst interface{})
| 32 | ) |
| 33 | |
| 34 | func parseRequestData(r *http.Request, dst interface{}) error { |
| 35 | ct := r.Header.Get("Content-Type") |
| 36 | |
| 37 | if ct == consts.ContentTypeForm { |
| 38 | if err := parseForm(r, dst); err != nil { |
| 39 | return errors.Wrap(err, "parsing form") |
| 40 | } |
| 41 | |
| 42 | return nil |
| 43 | } |
| 44 | |
| 45 | // default to JSON |
| 46 | if err := parseJSON(r, dst); err != nil { |
| 47 | return errors.Wrap(err, "parsing JSON") |
| 48 | } |
| 49 | |
| 50 | return nil |
| 51 | } |
| 52 | |
| 53 | func parseForm(r *http.Request, dst interface{}) error { |
| 54 | if err := r.ParseForm(); err != nil { |
no test coverage detected