我正在尝试执行 dio post 请求,我需要将正文指定为原始数据 Post
Response response = await (await init()).post(url, data: {
"token": token,
"code": formol}
);Run Code Online (Sandbox Code Playgroud)
尝试将其编码为 Json:
var json = {
"code": "xxxxxxxxx",
"token": "-------------",
};
...
Response response = await _dio.post(url,
options: Options(headers: {
HttpHeaders.contentTypeHeader: "application/json",
}),
data: jsonEncode(json),
);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4513 次 |
| 最近记录: |