patch method
Implementation
Future<Response?> patch(
String apiPath, {
Object? body,
bool jsonEncodeBody = true,
}) async {
Object? requestBody = body;
final client = http.Client();
if (jsonEncodeBody && body != null) {
requestBody = jsonEncode(body);
}
return _processApiCall(
httpApiConfig.maxRetryAttempts,
apiCall: () async {
return await client
.patch(
_generateApiUri(apiPath),
encoding: httpApiConfig.encoding,
body: requestBody,
headers: httpApiConfig.headers,
)
.timeout(
Duration(seconds: httpApiConfig.timeout),
onTimeout: () => throw Exception(
"API Timeout exception, no response from the server for: $apiPath",
),
);
},
onFinish: client.close,
);
}