你们能帮我把这个cURL转换成飞镖代码
curl --location --request POST'http:// prestao-service / leave / add'
--header'X-Auth-Token:dfd8d732-c066-463c-af4d-1a63e2f2b373'
--form'leave = {“ dateDemand”:1600732093584,“ dateStart”:1600732800000,“ dateEnd”:1601078400000,“ endDateDaySlot”:“ X”,“ startDateDaySlot”:“ X”,“ type”:“ CSS”}
'
我试过了,但是没用
var request = new http.MultipartRequest("POST", uri);
Map<String, String> heads = {
"X-Auth-Token": UserPreferences().token,
"Content-type": "multipart/form-data",
"accept": "application/json"
};
request.headers.addAll(heads);
request.fields['leave'] = json.encode({
"dateDemand": 1600732093584,
"dateStart": 1600732800000,
"dateEnd": 1601078400000,
"endDateDaySlot": "X",
"startDateDaySlot": "X",
"type": "CSS"
});
var response = await request.send();