v1.0.24 http utf8
This commit is contained in:
parent
9311a888bc
commit
ec2f6bc907
@ -1,5 +1,9 @@
|
|||||||
Workout Test and Diet 4 You Common Util Functions
|
Workout Test and Diet 4 You Common Util Functions
|
||||||
|
|
||||||
|
### Version 1.0.24
|
||||||
|
|
||||||
|
http get utf8
|
||||||
|
|
||||||
### Version 1.0.23
|
### Version 1.0.23
|
||||||
|
|
||||||
webapi CORS solution with the API
|
webapi CORS solution with the API
|
||||||
|
@ -63,10 +63,15 @@ class APIWebClient with Common, Logging {
|
|||||||
Cache().authToken = authToken;
|
Cache().authToken = authToken;
|
||||||
}
|
}
|
||||||
var uri = Uri.parse(url);
|
var uri = Uri.parse(url);
|
||||||
var result = await http.post(uri, body: body, headers: {
|
var result = await http.post(
|
||||||
|
uri,
|
||||||
|
body: body,
|
||||||
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"Authorization": 'Bearer $authToken',
|
"Authorization": 'Bearer $authToken',
|
||||||
});
|
"charset": "UTF-8",
|
||||||
|
},
|
||||||
|
);
|
||||||
log(" ------------post response code: ${result.statusCode}");
|
log(" ------------post response code: ${result.statusCode}");
|
||||||
if (result.statusCode == 200) {
|
if (result.statusCode == 200) {
|
||||||
return result.body;
|
return result.body;
|
||||||
@ -95,14 +100,18 @@ class APIWebClient with Common, Logging {
|
|||||||
Cache().authToken = authToken;
|
Cache().authToken = authToken;
|
||||||
}
|
}
|
||||||
var uri = Uri.parse(url);
|
var uri = Uri.parse(url);
|
||||||
var result = await http.get(uri, headers: {
|
var result = await http.get(
|
||||||
|
uri,
|
||||||
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"Authorization": 'Bearer $authToken',
|
"Authorization": 'Bearer $authToken',
|
||||||
});
|
"charset": "UTF-8",
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
log(" ------------get response code: ${result.statusCode}");
|
log(" ------------get response code: ${result.statusCode}");
|
||||||
if (result.statusCode == 200) {
|
if (result.statusCode == 200) {
|
||||||
return result.body;
|
return utf8.decode(result.bodyBytes);
|
||||||
} else if (result.statusCode == 404) {
|
} else if (result.statusCode == 404) {
|
||||||
throw const NotFoundException(message: "Not Found");
|
throw const NotFoundException(message: "Not Found");
|
||||||
} else {
|
} else {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: workouttest_util
|
name: workouttest_util
|
||||||
description: Workout Test app and web functions.
|
description: Workout Test app and web functions.
|
||||||
version: 1.0.23
|
version: 1.0.24
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.18.6 <3.0.0"
|
sdk: ">=2.18.6 <3.0.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user