Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
gmalpha_flutter
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mobile
gmalpha_flutter
Commits
6ad51be4
Commit
6ad51be4
authored
Jul 17, 2019
by
jinzhu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
9426b40d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
8 deletions
+14
-8
DioUtil.dart
lib/netWork/DioUtil.dart
+8
-6
message_home.dart
lib/pages/message/home/message_home.dart
+6
-2
No files found.
lib/netWork/DioUtil.dart
View file @
6ad51be4
...
@@ -179,11 +179,11 @@ class DioUtil {
...
@@ -179,11 +179,11 @@ class DioUtil {
if
(
_dio
!=
null
)
{
if
(
_dio
!=
null
)
{
_dio
.
options
=
_options
;
_dio
.
options
=
_options
;
//
(_dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = (client) {
(
_dio
.
httpClientAdapter
as
DefaultHttpClientAdapter
).
onHttpClientCreate
=
(
client
)
{
//
client.findProxy = (url) {
client
.
findProxy
=
(
url
)
{
//
return _isDebug ? 'PROXY $_proxy' : 'DIRECT';
return
_isDebug
?
'PROXY
$_proxy
'
:
'DIRECT'
;
//
};
};
//
};
};
if
(
_pem
!=
null
)
{
if
(
_pem
!=
null
)
{
// httpClientAdapter
// httpClientAdapter
(
_dio
.
httpClientAdapter
as
DefaultHttpClientAdapter
).
onHttpClientCreate
=
(
client
)
{
(
_dio
.
httpClientAdapter
as
DefaultHttpClientAdapter
).
onHttpClientCreate
=
(
client
)
{
...
@@ -384,7 +384,9 @@ class DioUtil {
...
@@ -384,7 +384,9 @@ class DioUtil {
void
_mergeNativeCookie
(
HttpConfig
config
)
{
void
_mergeNativeCookie
(
HttpConfig
config
)
{
//合并native cookie
//合并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
(
'cookie---------'
);
print
(
_options
.
headers
);
print
(
_options
.
headers
);
...
...
lib/pages/message/home/message_home.dart
View file @
6ad51be4
...
@@ -29,8 +29,12 @@ class _MessageHomePageState extends State<MessageHomePage> {
...
@@ -29,8 +29,12 @@ class _MessageHomePageState extends State<MessageHomePage> {
void
initState
()
{
void
initState
()
{
if
(
nativeCookie
.
keys
.
length
>
0
)
{
if
(
nativeCookie
.
keys
.
length
>
0
)
{
BaseOptions
options
=
DioUtil
.
getDefOptions
();
BaseOptions
options
=
DioUtil
.
getDefOptions
();
Map
<
String
,
dynamic
>
cookie
=
{
'cookie'
:
'_gm_token=4cabd51562739648; _gtid=fac513b6a2bf11e9acfd525400e5c7a38141; sessionid=7j7s902fmro0pvybwrp374khvva6l3xf;'
};
Map
cookie
=
this
.
nativeCookie
;
HttpConfig
config
=
new
HttpConfig
(
options:
options
,
nativeCookie:
cookie
);
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
);
DioUtil
().
setConfig
(
config
);
}
}
super
.
initState
();
super
.
initState
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment