-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
New Issue Checklist
- I have searched for a similar issue in the project and found none
Issue Info
| Info | Value | |
|---|---|---|
| Platform Name | flutter / web | |
| Platform Version | 1.10.5 | |
| Dio Version | 3.0.3 | |
| Repro rate | 100% | |
| Repro with our demo prj | no related content | |
| Demo project link | Can't Provide |
Issue Description and Steps
I have this URL = https://thelot-lab.encoreent.rocks/bridge.php
with this content:
?php
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Headers: Cookie, X-API-KEY, Origin, X-CSRF-TOKEN, X-XSRF-TOKEN, X-Requested-With, Access-Control-Allow-Origin, Authorization, Content-Type, Accept, Access-Control-Request-Method");
header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE, PATCH");
header("Allow: GET, POST, OPTIONS, PUT, DELETE, PATCH");
header('Access-Control-Allow-Credentials: true');
echo "Hola Mundo";
And I have this code in flutter:
Dio _dio = Dio();
var result = await _dio.post(
"https://thelot-lab.encoreent.rocks/bridge.php",
options: Options(headers: {"token":"1234567890"}),
);
print(result.data);
And the browser console show me:
browser_adapter.dart:94 OPTIONS https://thelot-lab.encoreent.rocks/bridge.php net::ERR_HTTP2_PROTOCOL_ERROR
errors.dart:145 Uncaught (in promise) Error: DioError [DioErrorType.RESPONSE]: XMLHttpRequest error.
package:build_web_compilers/src/dev_compiler/dart_sdk.js 125229:30 get current
package:dio/src/adapters/browser_adapter.dart 79:20
package:build_web_compilers/src/dev_compiler/dart_sdk.js 41457:58 runUnary
package:build_web_compilers/src/dev_compiler/dart_sdk.js 37335:29 handleValue
package:build_web_compilers/src/dev_compiler/dart_sdk.js 37837:49 handleValueCallback
package:build_web_compilers/src/dev_compiler/dart_sdk.js 37869:17 _propagateToListeners
package:build_web_compilers/src/dev_compiler/dart_sdk.js 37721:25 [_complete]
package:build_web_compilers/src/dev_compiler/dart_sdk.js 41789:24 _cancelAndValue
package:build_web_compilers/src/dev_compiler/dart_sdk.js 23989:17
package:build_web_compilers/src/dev_compiler/dart_sdk.js 4196:16 _checkAndCall
package:build_web_compilers/src/dev_compiler/dart_sdk.js 4201:17 dcall
package:build_web_compilers/src/dev_compiler/dart_sdk.js 106110:96
at Object.createErrorWithStack (errors.dart:227)
at Object._rethrow (async_patch.dart:200)
at async._AsyncCallbackEntry.new.callback (zone.dart:1113)
at Object._microtaskLoop (schedule_microtask.dart:41)
at _startMicrotaskLoop (schedule_microtask.dart:50)
at async_patch.dart:166
Could you help me with this error?