【发布时间】:2020-04-08 19:27:56
【问题描述】:
我正在使用http客户端进行flutter网络调用。
- 我的请求正在处理邮递员,得到正确响应,
- 但在尝试使用 http.post 时,它返回错误代码 307-临时重定向,
方法体:
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;
});
}
此外,相同的代码会返回对其他请求和 URL 的正确响应。 首先我尝试使用 chopper 客户端,但遇到了同样的问题。
我无法从服务器端检测到该问题。
任何帮助/提示都会有所帮助
【问题讨论】:
标签: flutter