(formData []byte, contentType string)
| 106 | } |
| 107 | |
| 108 | func parseMultipart(formData []byte, contentType string) (map[string]interface{}, error) { |
| 109 | d, params, err := mime.ParseMediaType(contentType) |
| 110 | if err != nil || d != "multipart/form-data" { |
| 111 | return nil, http.ErrNotMultipart |
| 112 | } |
| 113 | boundary, ok := params["boundary"] |
| 114 | if !ok { |
| 115 | return nil, http.ErrMissingBoundary |
| 116 | } |
| 117 | reader := multipart.NewReader(bytes.NewReader(formData), boundary) |
| 118 | ret := make(map[string]interface{}) |
| 119 | |
| 120 | f, err := reader.ReadForm(32 << 20) |
| 121 | if err != nil { |
| 122 | return nil, err |
| 123 | } |
| 124 | for k, v := range f.Value { |
| 125 | if len(v) > 0 { |
| 126 | ret[k] = v[0] |
| 127 | } |
| 128 | } |
| 129 | for k, v := range f.File { |
| 130 | if len(v) > 0 { |
| 131 | ret[k] = v[0].Filename |
| 132 | } |
| 133 | } |
| 134 | return ret, nil |
| 135 | } |
| 136 | |
| 137 | func resolveOperationValues(pathItem string, values map[string]interface{}, beforeFunctions []functionInfo) (map[string]string, error) { |
| 138 | dbItem, err := newResolveDB(pathItem) |
no outgoing calls
no test coverage detected