SetFileBytes set up a multipart form with given []byte to upload.
(paramName, filename string, content []byte)
| 277 | |
| 278 | // SetFileBytes set up a multipart form with given []byte to upload. |
| 279 | func (r *Request) SetFileBytes(paramName, filename string, content []byte) *Request { |
| 280 | r.SetFileUpload(FileUpload{ |
| 281 | ParamName: paramName, |
| 282 | FileName: filename, |
| 283 | GetFileContent: func() (io.ReadCloser, error) { |
| 284 | return io.NopCloser(bytes.NewReader(content)), nil |
| 285 | }, |
| 286 | }) |
| 287 | return r |
| 288 | } |
| 289 | |
| 290 | // SetFiles set up a multipart form from a map to upload, which |
| 291 | // key is the parameter name, and value is the file path. |