Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dio can not request https://domain:port #2166

Closed
Coder7777 opened this issue Mar 27, 2024 · 6 comments
Closed

Dio can not request https://domain:port #2166

Coder7777 opened this issue Mar 27, 2024 · 6 comments

Comments

@Coder7777
Copy link

Package

dio

Version

4.0.6

Operating-System

Android, iOS

Adapter

Default Dio

Output of flutter doctor -v

[!] Flutter (Channel main, 3.20.0-17.0.pre.53, on macOS 14.2 23C64 darwin-arm64, locale en-CA)
    ! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/3.0.4/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /Library/flutter. Consider adding
      /Library/flutter/bin to the front of your path.
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2023.3.4)
[✓] VS Code (version 1.71.2)
[✓] VS Code (version 1.87.2)
[✓] Connected device (4 available)
[✓] Network resources

Dart Version

3.20.0

Steps to Reproduce

Use Dio to request(Get Method) https://www.abc.com:5001/api/test.

It will throw the error "No address associated with hostname". But the webapi is running well, I am sure I can use postman to get data from same API URL.

If I use my domain(https://www.abc.com/api/test) as the default port(443), then Dio works as expected.

Why Dio dose not support https://domain:port this way?

Expected Result

get the json output

Actual Result

Get the error “No address associated with hostname”

image
@Coder7777 Coder7777 added h: need triage This issue needs to be categorized s: bug Something isn't working labels Mar 27, 2024
@AlexV525
Copy link
Member

You're using a outdated package version and an unknown Dart version. We no longer support Dio 4.x.

Besides, please check your internet connection and permission on your devices.

@AlexV525 AlexV525 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 27, 2024
@AlexV525 AlexV525 added i: not related and removed h: need triage This issue needs to be categorized s: bug Something isn't working labels Mar 27, 2024
@Coder7777
Copy link
Author

Coder7777 commented Mar 28, 2024

You're using a outdated package version and an unknown Dart version. We no longer support Dio 4.x.

Besides, please check your internet connection and permission on your devices.

Dart SDK version: 3.4.0-190.0.dev (dev) (Thu Feb 29 08:14:33 2024 -0800) on "macos_arm64"

I do not think it cause by my network, I can get responses from Chrome browser and Postman when I call
https://abc.domain.com:5001/api/test.

I create a new empty flutter project, chose Dio 5.4.2. It is the same error.

@Coder7777
Copy link
Author

          final dio = Dio();
          var result = await dio.get(
            "https://qqlykm.cn:443/api/free/ip/get",
            options: Options(
              contentType: Headers.jsonContentType,
            ),
          );
        },

you can try above codes. I think you can get the same error with me.

image

@Coder7777
Copy link
Author

@AlexV525

@Coder7777
Copy link
Author

Postman result

image

@AlexV525
Copy link
Member

AlexV525 commented Mar 28, 2024

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants