Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
base_data_channel
Project
Project
Details
Activity
Releases
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
PublicSource
base_data_channel
Commits
a13617d2
Commit
a13617d2
authored
Dec 28, 2023
by
tongzifang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PrettyDioLogger
parent
bc0dc184
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
basedio.dart
lib/http/basedio.dart
+12
-12
No files found.
lib/http/basedio.dart
View file @
a13617d2
...
...
@@ -9,8 +9,6 @@ import 'package:sp_util/sp_util.dart';
import
'header_interceptor.dart'
;
class
BaseDio
{
BaseDio
.
_
();
...
...
@@ -26,18 +24,20 @@ class BaseDio {
final
Dio
dio
=
Dio
();
dio
.
options
=
BaseOptions
(
receiveTimeout:
Duration
(
seconds:
5
),
connectTimeout:
Duration
(
seconds:
5
),
sendTimeout:
Duration
(
seconds:
5
),
connectTimeout:
Duration
(
seconds:
5
),
sendTimeout:
Duration
(
seconds:
5
),
baseUrl:
QmaiHost
.
getBaseUrl
());
// 设置超时时间等 ...
dio
.
interceptors
.
add
(
HeaderInterceptor
());
// 添加拦截器,如 token之类,需要全局使用的参数
dio
.
interceptors
.
add
(
PrettyDioLogger
(
// 添加日志格式化工具类
requestHeader:
true
,
requestBody:
true
,
responseBody:
true
,
responseHeader:
false
,
compact:
false
,
));
if
(
SpUtil
.
getString
(
'build_type'
)
!=
'release'
)
{
dio
.
interceptors
.
add
(
PrettyDioLogger
(
// 添加日志格式化工具类
requestHeader:
true
,
requestBody:
true
,
responseBody:
true
,
responseHeader:
true
,
compact:
true
,
));
}
checkForCharlesProxy
(
dio
);
// (dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = (client) {
//
...
...
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