put method
Future<Response>
put(
- dynamic url, {
- dynamic body,
- Encoding? encoding,
})
Implementation
Future<Response> put(url,
{Map<String, String>? headers, body, Encoding? encoding}) async {
try {
final response =
await http.put(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);
}
}