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

Response Header is missing except content-length & content-type #2105

Closed
rnp0728 opened this issue Jan 24, 2024 · 6 comments
Closed

Response Header is missing except content-length & content-type #2105

rnp0728 opened this issue Jan 24, 2024 · 6 comments

Comments

@rnp0728
Copy link

rnp0728 commented Jan 24, 2024

Package

dio

Version

5.4.0

Operating-System

Linux

Output of flutter doctor -v

flutter doctor -v
[✓] Flutter (Channel stable, 3.16.8, on Pop!_OS 22.04 LTS
    6.6.6-76060606-generic, locale en_US.UTF-8)
    • Flutter version 3.16.8 on channel stable at
      /home/rnp/snap/flutter/common/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 67457e669f (7 days ago), 2024-01-16 16:22:29 -0800
    • Engine revision 6e2ea58a5c
    • Dart version 3.2.5
    • DevTools version 2.28.5

[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /home/rnp/Android/Sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /usr/bin/java
    • Java version OpenJDK Runtime Environment (build
      11.0.21+9-post-Ubuntu-0ubuntu122.04)
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/linux#android-setup for
      more details.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 10.0.0-4ubuntu1
    • cmake version 3.16.3
    • ninja version 1.10.0
    • pkg-config version 0.29.1

[!] Android Studio (not installed)
    • Android Studio not found; download from
      https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup
      for detailed instructions).

[✓] VS Code (version 1.85.2)
    • VS Code at /usr/share/code
    • Flutter extension version 3.80.0

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Pop!_OS 22.04 LTS
      6.6.6-76060606-generic
    • Chrome (web)    • chrome • web-javascript • Google Chrome 120.0.6099.224

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 2 categories.

Dart Version

3.2.5

Steps to Reproduce

Try sending Cookie's from backend, then the headers are missing
image

Expected Result

I should get the set-cookie data from dio response headers.
image

Actual Result

image

// Response Header in Web
image

@rnp0728 rnp0728 added h: need triage This issue needs to be categorized s: bug Something isn't working labels Jan 24, 2024
@rnp0728
Copy link
Author

rnp0728 commented Jan 24, 2024

This is a web based project so, ignore the android studio / toolchain related errors,

@AlexV525
Copy link
Member

On the Web, cookies are implicitly handled by the browser. All you need to do is to enable BrowserHttpClientAdapter.withCredentials.

@rnp0728
Copy link
Author

rnp0728 commented Jan 24, 2024

DioError ║ DioExceptionType.connectionError
The connection errored: The XMLHttpRequest onError callback was called. This typically indicates an error on the network layer. This indicates an error which most likely cannot be solved by the library.

New error comes up due to this code

 _dio.httpClientAdapter = BrowserHttpClientAdapter(withCredentials: true);

@AlexV525 Any solutions for this error? may be it is something related to CORS

@AlexV525
Copy link
Member

As the error stated:

This typically indicates an error on the network layer. This indicates an error which most likely cannot be solved by the library.

Closing as the issue becomes unactionable.

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

rnp0728 commented Jan 24, 2024

@AlexV525 I am sending a api request to the baceknd of the server and in the response i am getting 10 response header which also includes a cookie, but currently i am able to fetch only 2 of them (content-type, content-length).

@nohli
Copy link

nohli commented Aug 5, 2024

@rnp0728 in our case this was the fix.

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

3 participants