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 not produce null response body #1904

Closed
NguyenDinhTruong97 opened this issue Jul 25, 2023 · 2 comments
Closed

Response not produce null response body #1904

NguyenDinhTruong97 opened this issue Jul 25, 2023 · 2 comments

Comments

@NguyenDinhTruong97
Copy link

Package

dio

Version

5.3.0

Output of flutter doctor -v

[✓] Flutter (Channel stable, 3.10.6, on macOS 12.6.3 21G419 darwin-x64, locale en-VN)
    • Flutter version 3.10.6 on channel stable at /Users/admin/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision f468f3366c (12 days ago), 2023-07-12 15:19:05 -0700
    • Engine revision cdbeda788a
    • Dart version 3.0.6
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
    • Android SDK at /Users/admin/Library/Android/sdk
    • Platform android-33, build-tools 33.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14C18
    • CocoaPods version 1.12.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • 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 11.0.15+0-b2043.56-8887301)

[✓] Connected device (4 available)
    • Star 5 (mobile)      • BRB00064261                              • android-arm64  • Android 11 (API 30)
    • Gym iPhone (mobile) • 4a00cbe28e36bde37a76a2eadb4afd946148b613 • ios            • iOS 14.7.1 18G82
    • macOS (desktop)      • macos                                    • darwin-x64     • macOS 12.6.3 21G419 darwin-x64
    • Chrome (web)         • chrome                                   • web-javascript • Google Chrome 114.0.5735.198

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

• No issues found!

Dart Version

3.0.6

Steps to Reproduce

  1. Set dio.options.responseType = ResponseType.json;
  2. Request to GET data from API

Expected Result

Response produce null result

Actual Result

Response is String with "" value

@NguyenDinhTruong97 NguyenDinhTruong97 added h: need triage This issue needs to be categorized s: bug Something isn't working labels Jul 25, 2023
@AlexV525
Copy link
Member

AlexV525 commented Jul 25, 2023

The response data will be null if your content-type is defined as application/json in your response header.

@AlexV525 AlexV525 added h: need more info Further information is requested and removed h: need triage This issue needs to be categorized s: bug Something isn't working labels Jul 26, 2023
@VasanthakumarTW
Copy link

If Response type is application/json - DioError.Response.Data is coming null

@AlexV525 AlexV525 closed this as not planned Won't fix, can't repro, duplicate, stale Oct 24, 2023
@AlexV525 AlexV525 added i: no useful information and removed h: need more info Further information is requested labels Oct 24, 2023
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