genericBeaHttpPost method
Implementation
Future<Response> genericBeaHttpPost(String url, String jsonInput) async {
try{
if(!await _beaNetworkManager!.checkNetworkConnection()){
throw new BeaInternetException("No internet connection");
}
String? token = await _storage.read(key: KeyUtils.KEY_TOKEN_SESSION);
Map<String, String> headers = {
"Authorization": "Bearer $token",
"Content-Type": "application/json",
"User-agent": "http.agent"
};
Response response = await genericHttpPost(url, headers, jsonInput);
if(response.statusCode == 400){
print(response.data);
throw new BeaInternetException("Input format value not valid");
}
return response;
}on TimeoutException catch (_) {
print('Request Timeout');
FLog.error(
className: this.runtimeType.toString(),
methodName: "genericBeaHttpPost",
text: 'Request Timeout');
throw new BeaInternetException("Request Timeout");
} on BeaInternetException catch (e){
print('BEA HTTP POST request error');
FLog.error(
className: this.runtimeType.toString(),
methodName: "genericBeaHttpPost",
text: 'BEA HTTP POST request error - Input value format not valid - $e');
throw new Exception(e);
} on Exception catch (e){
print('BEA HTTP POST request error');
FLog.error(
className: this.runtimeType.toString(),
methodName: "genericBeaHttpPost",
text: 'BEA HTTP POST request error - $e');
throw e;
}
}