我正在使用 http 客户端进行 flutter 网络调用。
方法体:
static Future<http.Response> httpPost(
Map postParam, String serviceURL) async {
Map tempParam = {"id": "username", "pwd": "password"};
var param = json.encode(tempParam);
serviceURL = "http:xxxx/Login/Login";
// temp check
Map<String, String> headers = {
'Content-Type': 'application/json',
'cache-control': 'no-cache',
};
await http.post(serviceURL, headers: headers, body: param).then((response) {
return response;
});
}
Run Code Online (Sandbox Code Playgroud)
此外,相同的代码会返回对其他请求和 URL 的正确响应。首先,我尝试使用 chopper 客户端,但遇到了同样的问题。
我无法从服务器端检测到该问题。
任何帮助/提示都会有帮助
小智 12
/尝试在 的末尾添加斜杠serviceUrl。因此,serviceUrlserviceURL = "http:xxxx/Login/Login/"代替了serviceURL = "http:xxxx/Login/Login"。
这对我有用。
| 归档时间: |
|
| 查看次数: |
4469 次 |
| 最近记录: |