post method
Future<Response>
post(
- dynamic url, {
- dynamic body,
- Encoding? encoding,
})
Implementation
Future<Response> post(url,
{Map<String, String>? headers, body, Encoding? encoding}) async {
try {
final response = await http.post(url,
headers: headers, body: body, encoding: encoding);
if (response.statusCode == 401 &&
json.decode(response.body)['message'] == 'Expired JWT Token') {
throw ExpiredTokenException(response.reasonPhrase);
} else {
return response;
}
} catch (e) {
return http.Response(e.toString(), 500);
}
}