fix: failed to view article

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2024-11-11 19:00:16 +08:00
parent 391400a94d
commit 2d391a5a6c
3 changed files with 10 additions and 6 deletions

View File

@@ -191,15 +191,13 @@ class Request {
*/
Future get(url, {data, options, cancelToken, extra}) async {
Response response;
options ??= Options();
ResponseType resType = ResponseType.json;
if (extra != null) {
resType = extra!['resType'] ?? ResponseType.json;
if (extra['ua'] != null) {
options.headers = {'user-agent': headerUa(type: extra['ua'])};
options ??= Options();
options.headers ??= <String, dynamic>{};
options.headers!['user-agent'] = headerUa(type: extra['ua']);
}
}
options.responseType = resType;
try {
response = await dio.get(