add content-type to api/ab/get

This commit is contained in:
djordans 2023-03-27 17:02:46 +02:00 committed by GitHub
parent 679d3d9868
commit 90a43a5110
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,7 +27,9 @@ class AbModel {
abError.value = "";
final api = "${await bind.mainGetApiServer()}/api/ab/get";
try {
final resp = await http.post(Uri.parse(api), headers: getHttpHeaders());
var authHeaders = getHttpHeaders();
authHeaders['Content-Type'] = "application/json";
final resp = await http.post(Uri.parse(api), headers: authHeaders);
if (resp.body.isNotEmpty && resp.body.toLowerCase() != "null") {
Map<String, dynamic> json = jsonDecode(resp.body);
if (json.containsKey('error')) {