Merge pull request #3806 from djordans/patch-3

add content-type to api/ab/get
This commit is contained in:
RustDesk 2023-03-27 23:23:29 +08:00 committed by GitHub
commit 44fdfafa4b
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')) {