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

302没有带上cookie #2180

Closed
yanweimin7 opened this issue Apr 10, 2024 · 1 comment
Closed

302没有带上cookie #2180

yanweimin7 opened this issue Apr 10, 2024 · 1 comment

Comments

@yanweimin7
Copy link

yanweimin7 commented Apr 10, 2024

Package

dio

Version

5.2.1+1

Operating-System

Android

Adapter

Default Dio

Output of flutter doctor -v

[✓] Flutter (Channel stable, 3.10.6, on macOS 14.4 23E214 darwin-arm64, locale zh-Hans-CN)
[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
[✓] Chrome - develop for the web
[!] Android Studio (version 2023.2)
    ✗ Unable to find bundled Java version.
[✓] VS Code (version 1.88.0)

Dart Version

3.0.6

Steps to Reproduce

  1. 调用一个get请求,比如url https://www.xxx.com/a/b , 该url要带上cookie才能返回正确内容,否则会返回302,
  2. 当第一次调用时 ,由于没有带上cookie,因此header里面会返回set cookie, 如
Set-Cookie:
EO-Bot-Session=leoiD3kj4ttGbnfyzIHIgzCpD0SEOWCOLah7puYe9OfU7TF07893ChR-P2geuwAs; max-age=7800; Domain=.xxx.com; path=/; HttpOnly

Set-Cookie:
EO-Bot-SessionId=17523055444970748937; max-age=7800; Domain=.xxx.com; path=/; HttpOnly
Set-Cookie:
EO-Bot-Token=; max-age=3900; Domain=.xxx.com; path=/;

且Location依然是/a/b

2 . 此时dio默认会重定向重新请求 https://www.xxx.com/a/b, 但没有带上上次返回的cookie,导致一直302。

Expected Result

期望遇到302重定向前,从上次response取出cookie,作为下一次的request header

Actual Result

302没有带上上次response的cookie

@yanweimin7 yanweimin7 added h: need triage This issue needs to be categorized s: bug Something isn't working labels Apr 10, 2024
@AlexV525
Copy link
Member

test('can be saved to the location', () async {

这里的单测没有出问题,请利用 httpbun.com 提供最小复现 demo。

@AlexV525 AlexV525 added i: cannot reproduce and removed h: need triage This issue needs to be categorized s: bug Something isn't working labels May 2, 2024
@AlexV525 AlexV525 closed this as not planned Won't fix, can't repro, duplicate, stale May 2, 2024
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