put method
Implementation
Future<WebResponse> put(
{required String path, required Map<String, dynamic>? jsonBody}) async {
var url = '${_removeTrailingSlash(baseUrl)}/${_removeLeadingSlash(path)}';
final response = await RequestsPlus.put(url,
json: jsonBody,
headers: {'Content-Type': 'application/json'},
withCredentials: true,
timeoutSeconds: 60)
.onError((e, s) {
throw Exception('PUT request failed: ${e.toString()}');
});
if (response.success) {
return WebResponse(body: response.body);
} else if (response.statusCode == 401) {
appManager.clearCurrentUser();
return WebResponse.unAuthorized(response.body);
} else {
return WebResponse.systemError(response.body);
}
}