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

Got status 3xx with followRedirects is true #3066

Open
LondonX opened this issue Mar 29, 2024 · 0 comments
Open

Got status 3xx with followRedirects is true #3066

LondonX opened this issue Mar 29, 2024 · 0 comments
Assignees

Comments

@LondonX
Copy link

LondonX commented Mar 29, 2024

ATTENTION: DO NOT USE THIS FIELD TO ASK SUPPORT QUESTIONS. USE THE PLATFORM CHANNELS FOR THIS. THIS SPACE IS DEDICATED ONLY FOR BUGS DESCRIPTION.
Fill in the template. Issues that do not respect the model will be closed.

Describe the bug
Make get request with GetConnect got status code 301 (Moved Permanently), while wget works well.

Reproduction code
NOTE: THIS IS MANDATORY, IF YOUR ISSUE DOES NOT CONTAIN IT, IT WILL BE CLOSED PRELIMINARY)

static final _connect = GetConnect(
    timeout: const Duration(seconds: 10),
    allowAutoSignedCert: true,
    followRedirects: true,
    maxRedirects: 999,
);

static Future<void> getVersion() async {
  final raw = await _connect.get(
    "https://httpbin.org/redirect-to?url=https%3A%2F%2Fhttpbin.org%2Fip&status_code=301",
    headers: _appHeaders,
  );
  final status = raw.statusCode;
  print(status)
}

To Reproduce

  1. Call getVersion method.
  2. will print 301.

Expected behavior
follow redirect to https://httpbin.org/ip , and your current IP returned in response json, and print 200.

Screenshots
301 MOVE PERMANENTLY
image
302 FOUND
image
URL works well in wget
image

Flutter Version:
Flutter 3.19.4 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 68bfaea224 (8 days ago) • 2024-03-20 15:36:31 -0700
Engine • revision a5c24f538d
Tools • Dart 3.3.2 • DevTools 2.31.1

Getx Version:
get:
dependency: "direct main"
description:
name: get
sha256: e4e7335ede17452b391ed3b2ede016545706c01a02292a6c97619705e7d2a85e
url: "https://pub.dev"
source: hosted
version: "4.6.6"

Describe on which device you found the bug:
Pixel 3 - Android.

Minimal reproduce code

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

No branches or pull requests

2 participants