You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is the file I am using for the APi call whenever I hit an api call it give me the same error every time
Non-401 error occurred: 503
I/flutter (12641): Error while posting data: DioException [bad response]: This exception was thrown because the response has a status code of 503 and RequestOptions.validateStatus was configured to throw for this status code.
Expected Result
it should return the response work normally.
it is working correctly with the http URL
Package
dio
Version
5.4.3+1
Operating-System
Android, iOS
Adapter
Default Dio
Output of
flutter doctor -v
Dart Version
3.4.1
Steps to Reproduce
class ApiService {
late Dio _dio;
ApiService() {
BaseOptions options = BaseOptions(
baseUrl: URL.BASE_URL,
contentType: Headers.jsonContentType,
responseType: ResponseType.plain,
maxRedirects: 2,
connectTimeout: const Duration(milliseconds: 60000),
receiveTimeout: const Duration(milliseconds: 60000),
);
_dio = Dio(options);
}
// Method to perform GET requests
Future<Response> fetchData(String path) async {
try {
return await _dio.get(path);
} catch (e) {
print("Error while fetching data: $e");
throw e;
}
}
// Method to perform POST requests
Future<Response> postData(String path, dynamic data) async {
try {
return await _dio.post(path, data: data);
} catch (e) {
print("Error while posting data: $e");
throw e;
}
}
This is the file I am using for the APi call whenever I hit an api call it give me the same error every time
Non-401 error occurred: 503
I/flutter (12641): Error while posting data: DioException [bad response]: This exception was thrown because the response has a status code of 503 and RequestOptions.validateStatus was configured to throw for this status code.
Expected Result
it should return the response work normally.
it is working correctly with the http URL
Actual Result
Non-401 error occurred: 503
I/flutter (12641):
I/flutter (12641):
I/flutter (12641):
I/flutter (12641): <title>Application Error</title>
I/flutter (12641): <style media="screen">
I/flutter (12641): html,body,iframe {
I/flutter (12641): margin: 0;
I/flutter (12641): padding: 0;
I/flutter (12641): }
I/flutter (12641): html,body {
I/flutter (12641): height: 100%;
I/flutter (12641): overflow: hidden;
I/flutter (12641): }
I/flutter (12641): iframe {
I/flutter (12641): width: 100%;
I/flutter (12641): height: 100%;
I/flutter (12641): border: 0;
I/flutter (12641): }
I/flutter (12641): </style>
I/flutter (12641):
I/flutter (12641):
I/flutter (12641): <iframe src="//www.herokucdn.com/error-pages/application-error.html"></iframe>
I/flutter (12641):
I/flutter (12641):
The text was updated successfully, but these errors were encountered: