fix: Request get options.headers null error

This commit is contained in:
guozhigq
2024-11-16 15:35:48 +08:00
parent e9e5532a15
commit bfbae81997
2 changed files with 3 additions and 2 deletions

View File

@ -212,7 +212,8 @@ class Request {
if (extra != null) { if (extra != null) {
if (extra['ua'] != null) { if (extra['ua'] != null) {
options ??= Options(); options ??= Options();
options.headers!['user-agent'] = headerUa(type: extra['ua']); options.headers ??= <String, dynamic>{};
options.headers?['user-agent'] = headerUa(type: extra['ua']);
} }
} }
try { try {

View File

@ -117,7 +117,7 @@ class _MemberArchivePageState extends State<MemberArchivePage> {
} }
} else { } else {
return HttpError( return HttpError(
errMsg: snapshot.data['msg'], errMsg: snapshot.data?['msg'] ?? '请求异常',
fn: () {}, fn: () {},
); );
} }