我有在我的Flutter项目api使用cookie,他们不工作。我已经启用了生成curl的拦截器:
CurlLoggerDioInterceptor (printOnSuccess: true)
,结果如下:
curl -i
-H "Accept: application / json"
-H "Connection: keep-alive"
-H "cookie: ci_session = uv0hts7fb8us0r7m5vvaa64p4o89u9he"
-H "Authorization: 1652292531"
"http://xxxxx.it"
这在shell上有效。我不明白,为什么Dart代码生成的curl可以工作,而代码本身不能工作?
关于代码,我已经使用了这个链接中的所有解决方案(dio_cookie_manager, NetworkService, HTTP请求而不是dio…)我如何使一个http请求使用cookie在扑?
使用Dio是不可能的,但使用以下库是可以的:
flutter_curl: ^0.1.1