📜  发生异常. StateError(错误状态:无法设置内容类型为“application json”的请求的正文字段.) - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:40.488000             🧑  作者: Mango

代码示例1
import 'package:http/http.dart' as http;
import 'dart:convert';

Map headers = {'Content-Type':'application/json','authorization':'Basic c3R1ZHlkb3RlOnN0dWR5ZG90ZTEyMw=='};
final msg = jsonEncode({"grant_type":"password","username":"******","password":"*****","scope":"offline_access"});

var response = await post(Urls.getToken,
               headers: headers,
               body: msg,
            );