Commit 6ad51be4 authored by jinzhu's avatar jinzhu

update

parent 9426b40d
......@@ -179,11 +179,11 @@ class DioUtil {
if (_dio != null) {
_dio.options = _options;
// (_dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = (client) {
// client.findProxy = (url) {
// return _isDebug ? 'PROXY $_proxy' : 'DIRECT';
// };
// };
(_dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = (client) {
client.findProxy = (url) {
return _isDebug ? 'PROXY $_proxy' : 'DIRECT';
};
};
if (_pem != null) {
// httpClientAdapter
(_dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = (client) {
......@@ -384,7 +384,9 @@ class DioUtil {
void _mergeNativeCookie(HttpConfig config) {
//合并native cookie
_options.headers = (new Map.from(_options.headers))..addAll(config.nativeCookie);
Map<String, dynamic> headers = _options.headers;
headers['Cookie'] = config.nativeCookie['Cookie'];
_options.headers = headers;
print('cookie---------');
print(_options.headers);
......
......@@ -29,8 +29,12 @@ class _MessageHomePageState extends State<MessageHomePage> {
void initState() {
if (nativeCookie.keys.length > 0) {
BaseOptions options = DioUtil.getDefOptions();
Map<String, dynamic> cookie = {'cookie': '_gm_token=4cabd51562739648; _gtid=fac513b6a2bf11e9acfd525400e5c7a38141; sessionid=7j7s902fmro0pvybwrp374khvva6l3xf;'};
HttpConfig config = new HttpConfig(options: options, nativeCookie:cookie);
Map cookie = this.nativeCookie;
print('----22222222222222-----');
Map<String, dynamic> newCookie = {'Cookie': cookie['Cookie']};
options.baseUrl = cookie['host'] + '/';
print('----33333333333----');
HttpConfig config = new HttpConfig(options: options, nativeCookie:newCookie);
DioUtil().setConfig(config);
}
super.initState();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment