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] sendTimeout cannot be used without a request body to send #2255

Closed
shrijanRegmi opened this issue Jun 24, 2024 · 5 comments Β· Fixed by #2260
Closed

[πŸ”” Dio] sendTimeout cannot be used without a request body to send #2255

shrijanRegmi opened this issue Jun 24, 2024 · 5 comments Β· Fixed by #2260
Labels
platform: web s: feature This issue indicates a feature request

Comments

@shrijanRegmi
Copy link

Package

dio

Version

5.3.3

Operating-System

Web

Adapter

Default Dio

Output of flutter doctor -v

[!] Flutter (Channel stable, 3.22.0, on macOS 14.5 23F79 darwin-arm64, locale en-NP)
    β€’ Flutter version 3.22.0 on channel stable at /Users/shrijanregmi/fvm/versions/3.22.0
    ! Warning: `flutter` on your path resolves to /Users/shrijanregmi/Projects/Flutter/sdk/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/shrijanregmi/fvm/versions/3.22.0. Consider adding /Users/shrijanregmi/fvm/versions/3.22.0/bin to the front of your path.
    ! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/3.2.6/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /Users/shrijanregmi/fvm/versions/3.22.0. Consider adding /Users/shrijanregmi/fvm/versions/3.22.0/bin to the front of your path.
    β€’ Upstream repository https://github.com/flutter/flutter.git
    β€’ Framework revision 5dcb86f68f (7 weeks ago), 2024-05-09 07:39:20 -0500
    β€’ Engine revision f6344b75dc
    β€’ Dart version 3.4.0
    β€’ DevTools version 2.34.3
    β€’ If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[βœ“] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
    β€’ Android SDK at /Users/shrijanregmi/Library/Android/sdk
    β€’ Platform android-34, build-tools 33.0.2
    β€’ ANDROID_HOME = /Users/shrijanregmi/Library/Android/sdk/:/Users/shrijanregmi/Projects/Flutter/sdk/bin/:/Users/shrijanregmi/fvm/versions/3.22.0/bin/:/Library/Frameworks/Python.framework/Versions/3.12/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Users/shrijanregmi/fvm/versions/3.22.0/bin/:/Users/shrijanregmi/google-cloud-sdk/bin:/Users/shrijanregmi/.nvm/versions/node/v18.16.1/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/shrijanregmi/Library/Android/sdk/platform-tools/:/Users/shrijanregmi/Projects/Flutter/sdk/bin/:/Library/Frameworks/Python.framework/Versions/3.12/bin:/Users/shrijanregmi/.pub-cache/bin:/Users/shrijanregmi/.maestro/bin
    β€’ Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    β€’ Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    β€’ All Android licenses accepted.

[βœ“] Xcode - develop for iOS and macOS (Xcode 15.4)
    β€’ Xcode at /Applications/Xcode.app/Contents/Developer
    β€’ Build 15F31d
    β€’ CocoaPods version 1.15.2

[βœ“] Chrome - develop for the web
    β€’ Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[βœ“] Android Studio (version 2022.2)
    β€’ 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 17.0.6+0-17.0.6b802.4-9586694)

[βœ“] VS Code (version 1.90.1)
    β€’ VS Code at /Applications/Visual Studio Code.app/Contents
    β€’ Flutter extension version 3.90.0

[βœ“] Connected device (4 available)
    β€’ Shrijan’s iPhone  (mobile)      β€’ 00008130-001420681A90001C β€’ ios            β€’ iOS 17.5.1 21F90
    β€’ macOS (desktop)                 β€’ macos                     β€’ darwin-arm64   β€’ macOS 14.5 23F79 darwin-arm64
    β€’ Mac Designed for iPad (desktop) β€’ mac-designed-for-ipad     β€’ darwin         β€’ macOS 14.5 23F79 darwin-arm64
    β€’ Chrome (web)                    β€’ chrome                    β€’ web-javascript β€’ Google Chrome 126.0.6478.63

[βœ“] Network resources
    β€’ All expected network resources are available.

! Doctor found issues in 1 category.

Dart Version

3.4.0

Steps to Reproduce

  1. Create a dio instance
  2. Add sendTimeout = const Duration(seconds: 3)
  3. Hit a get request
  4. Observe the error

Expected Result

No error should be there

Actual Result

I get the following error when running dio on WEB. If I run it on Android or iOS, it works fine!

[πŸ”” Dio] sendTimeout cannot be used without a request body to send
[πŸ”” Dio] _StackTrace (../dart-sdk/lib/_internal/js_dev_runtime/patch/core_patch.dart 843:28  get current
         ../packages/dio/src/adapters/browser_adapter.dart 153:22               fetch
         ../dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54  runBody
         ../dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 127:5  _async
         ../packages/dio/src/adapters/browser_adapter.dart 34:29                fetch
         ../packages/dio/src/dio_mixin.dart 515:52                              _dispatchRequest
         ../dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 45:50  <fn>
         ../dart-sdk/lib/async/zone.dart 1661:54                                runUnary
         ../dart-sdk/lib/async/future_impl.dart 163:18                          handleValue
         ../dart-sdk/lib/async/future_impl.dart 847:44                          handleValueCallback
         ../dart-sdk/lib/async/future_impl.dart 876:13                          _propagateToListeners
         ../dart-sdk/lib/async/future_impl.dart 652:5                           [_completeWithValue]
         ../dart-sdk/lib/async/future_impl.dart 722:7                           callback
         ../dart-sdk/lib/async/schedule_microtask.dart 40:11                    _microtaskLoop
         ../dart-sdk/lib/async/schedule_microtask.dart 49:5                     _startMicrotaskLoop
         ../dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 181:7  <fn>
         )
@shrijanRegmi shrijanRegmi added h: need triage This issue needs to be categorized s: bug Something isn't working labels Jun 24, 2024
@kuhnroyal
Copy link
Member

Yes, it literally tells you that it doesn't work.

@Maatteogekko
Copy link

The problem, at least in my case, is that I set sendTimeout in the BaseOptions when initialising dio. I would expect it to be ignored for the requests that do not support it, without printing a warning.

@AlexV525 AlexV525 added s: feature This issue indicates a feature request platform: web and removed h: need triage This issue needs to be categorized s: bug Something isn't working labels Jul 1, 2024
@tomwyr
Copy link

tomwyr commented Oct 23, 2024

@AlexV525 How is one supposed to use a single client instance without being notified about sendInterval when sending GET requests? #2260 doesn't prevent Dio from logging the warning into console by the adapter.

@AlexV525
Copy link
Member

@tomwyr #2260 implements the log incorrectly, #2309 fixes it, could you check again on the main branch?

@tomwyr
Copy link

tomwyr commented Oct 23, 2024

I can still see the warning. The issue that you linked also says:

The warning will be raised within the adapter.

Which maybe explains why it didn't change the behavior I'm referring to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: web s: feature This issue indicates a feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants