I am using dart:http to make post request but it seems I cannot specify HTTP1.1 version which is required by target api. Ideally I need to re-create following request in dart:
curl -X POST --http1.1 "https://api.dummyapi.com/v1/route" -H "accept: text/plain" -H "Authorization: 000000-000000-000000-000000" -H "Content-Type: application/json-patch+json" -d "{}"
My current version is this:
final url = Uri.parse('https://api.dummyapi.com/v1/route');
final response = await http.post(url, headers: {
'Authorization': '000000-000000-000000-000000',
'accept': 'text/plain',
'Content-Type': 'application/json'
});```
Checked the following code example
Future createUserExample(Map<String,dynamic> data) async {
final http.Response response = await http.post(
'https://api.dummyapi.com/v1/route',
headers: <String, String>{
'Authorization': '000000-000000-000000-000000',
'accept': 'text/plain',
'Content-Type': 'application/json'
},
body: data,
);
return response;