post method
Implementation
Future<http.Response> post(
String ip,
String path, {
Map<String, String>? headers,
Map<String, dynamic>? body,
}) async {
final myIp = await _requireCurrentIp();
final uri = Uri.parse('http://$ip$path');
final binding = await DeviceRequestBindingModel.create(
clientIp: myIp,
serverIp: ip,
method: 'POST',
path: path,
);
return _engine.http.client.post(
uri,
headers: {
'Content-Type': 'application/json',
...?headers,
DuneRequestHeaders.clientIp.key: myIp,
...binding.toHeaders(),
},
body: body == null ? null : jsonEncode(body),
);
}