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
DioException (DioException [bad response]: This exception was thrown because the response has a status code of 401 and RequestOptions.validateStatus was configured to throw for this status code.
#2067
Closed
hupo376787 opened this issue
Dec 17, 2023
· 3 comments
flutter doctor -v
Flutter assets will be downloaded from https://storage.flutter-io.cn. Make sure you trust this source!
[✓] Flutter (Channel stable, 3.16.4, on Microsoft Windows [版本 10.0.22631.2861], locale zh-CN)
• Flutter version 3.16.4 on channel stable at D:\flutter\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 2e9cb0aa71 (6 days ago), 2023-12-11 14:35:13 -0700
• Engine revision 54a7145303
• Dart version 3.2.3
• DevTools version 2.28.4
• Pub download mirror https://pub.flutter-io.cn
• Flutter download mirror https://storage.flutter-io.cn
[✓] Windows Version (Installed version of Windows is version 10 or higher)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
• Android SDK at C:\Users\vivi\AppData\Local\Android\sdk
• Platform android-33-ext4, build-tools 33.0.1
• Java binary at: D:\Program Files\Android\Android Studio\jbr\bin\java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[✓] Visual Studio - develop Windows apps (Visual Studio Enterprise 2022 17.7.6)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Enterprise
• Visual Studio Enterprise 2022 version 17.7.34221.43
• Windows 10 SDK version 10.0.19041.0
[✓] Android Studio (version 2022.2)
• Android Studio at D:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)
[✓] VS Code (version 1.85.1)
• VS Code at C:\Users\vivi\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.78.0
[✓] Connected device (4 available)
• M2012K11AC (mobile) • d84983c6 • android-arm64 • Android 13 (API 33)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [版本 10.0.22631.2861]
• Chrome (web) • chrome • web-javascript • Google Chrome 120.0.6099.72
• Edge (web) • edge • web-javascript • Microsoft Edge 120.0.2210.61
[!] Network resources
✗ A cryptographic error occurred while checking "https://cocoapods.org/": Connection terminated during handshake
You may be experiencing a man-in-the-middle attack, your network may be compromised, or you may have malware installed on
your computer.
! Doctor found issues in 1 category.
DioException (DioException [bad response]: This exception was thrown because the response has a status code of 401 and RequestOptions.validateStatus was configured to throw for this status code.
The status code of 401 has the following meaning: "Client error - the request contains bad syntax or cannot be fulfilled"
Read more about status codes at https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
In order to resolve this exception you typically have either to verify and fix your request code or you have to fix the server code.
)
Also, I made a test using http, the code works fine.
try {
await http.get('https://www.weibo.com/');
} catch (e) {
print('catch: $e');
}
The text was updated successfully, but these errors were encountered:
Package
dio
Version
5.4.0
Operating-System
Windows
Output of
flutter doctor -v
Dart Version
3.2.3
Steps to Reproduce
try {
await Dio().get('https://www.weibo.com/');
} catch (e) {
print('catch: $e');
}
Expected Result
Code should work without exception
Actual Result
DioException (DioException [bad response]: This exception was thrown because the response has a status code of 401 and RequestOptions.validateStatus was configured to throw for this status code.
The status code of 401 has the following meaning: "Client error - the request contains bad syntax or cannot be fulfilled"
Read more about status codes at https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
In order to resolve this exception you typically have either to verify and fix your request code or you have to fix the server code.
)
Also, I made a test using http, the code works fine.
try {
await http.get('https://www.weibo.com/');
} catch (e) {
print('catch: $e');
}
The text was updated successfully, but these errors were encountered: