【发布时间】:2020-10-14 05:30:31
【问题描述】:
我想使用 HTTP 包发送表单数据。得到错误:FormatException: Unexpected character (at character 1) 我/颤振(30465): 我在 HTTP 发布请求中发送表单数据。
Future<void> authethicate(
String schoolName,
String password,
) async {
try {
final url = 'https://yobimx.com/citykey/api/users/login';
final response = await http.post(url, body: {
'email': 'usamashafiq199@outlook.com',
'password': '123',
}, headers: {
"Content-Type": "application/x-www-form-urlencoded",
});
print(
json.decode(response.body),
);
final responseData = json.decode(response.body);
} catch (error) {
print(error);
}
}
【问题讨论】:
-
如果你删除 json.decode 并打印 response.body,你会得到什么打印结果?