File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -80,18 +80,23 @@ pub fn post_form(url string, data map[string]string) ?Response {
80
80
)
81
81
}
82
82
83
+ [params]
83
84
pub struct PostMultipartFormConfig {
84
- form map [string ]string
85
- files map [string ][]FileData
85
+ pub mut :
86
+ form map [string ]string
87
+ files map [string ][]FileData
88
+ header Header
86
89
}
87
90
88
91
// post_multipart_form sends a POST HTTP request to the URL with multipart form data
89
92
pub fn post_multipart_form (url string , conf PostMultipartFormConfig) ? Response {
90
93
body , boundary := multipart_form_body (conf.form, conf.files)
94
+ mut header := conf.header
95
+ header.set (.content_type, 'multipart/form-data; boundary="$boundary "' )
91
96
return fetch (
92
97
method: .post
93
98
url: url
94
- header: new_header (key: .content_type, value: 'multipart/form-data; boundary=" $boundary "' )
99
+ header: header
95
100
data: body
96
101
)
97
102
}
You can’t perform that action at this time.
0 commit comments