📌  相关文章
📜  : 无法设置内容类型为“application json”的请求的正文字段. - Javascript代码示例

📅  最后修改于: 2022-03-11 15:01:21.910000             🧑  作者: 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,
            );