v1.0.24 http utf8
This commit is contained in:
+18
-9
@@ -63,10 +63,15 @@ class APIWebClient with Common, Logging {
|
||||
Cache().authToken = authToken;
|
||||
}
|
||||
var uri = Uri.parse(url);
|
||||
var result = await http.post(uri, body: body, headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": 'Bearer $authToken',
|
||||
});
|
||||
var result = await http.post(
|
||||
uri,
|
||||
body: body,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": 'Bearer $authToken',
|
||||
"charset": "UTF-8",
|
||||
},
|
||||
);
|
||||
log(" ------------post response code: ${result.statusCode}");
|
||||
if (result.statusCode == 200) {
|
||||
return result.body;
|
||||
@@ -95,14 +100,18 @@ class APIWebClient with Common, Logging {
|
||||
Cache().authToken = authToken;
|
||||
}
|
||||
var uri = Uri.parse(url);
|
||||
var result = await http.get(uri, headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": 'Bearer $authToken',
|
||||
});
|
||||
var result = await http.get(
|
||||
uri,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": 'Bearer $authToken',
|
||||
"charset": "UTF-8",
|
||||
},
|
||||
);
|
||||
|
||||
log(" ------------get response code: ${result.statusCode}");
|
||||
if (result.statusCode == 200) {
|
||||
return result.body;
|
||||
return utf8.decode(result.bodyBytes);
|
||||
} else if (result.statusCode == 404) {
|
||||
throw const NotFoundException(message: "Not Found");
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user