post method
Sends a POST request and returns the raw status code and body.
timeout is advisory; implementations should honor it when supported and
surface timeouts as exceptions rather than swallowing them.
Implementation
@override
Future<HttpResponse> post({
required String url,
required String body,
required Map<String, String> headers,
Duration? timeout,
}) async {
final mergedHeaders = <String, String>{
'Content-Type': 'application/json',
...headers,
};
final response = await http
.post(Uri.parse(url), headers: mergedHeaders, body: body)
.timeout(timeout ?? defaultTimeout);
return HttpResponse(statusCode: response.statusCode, body: response.body);
}