postman请求可以
最近开发项目时,在自己电脑上运行了一个项目,postman可以请求成功
换到项目中出现报错
{
"errMsg": "request:fail abort statusCode:-1 Failed to connect to /127.0.0.1:8080",
"config": {
"baseURL": "http://127.0.0.1:8080/api/",
"method": "POST",
"url": "/distribution/facade/loadDistributionOrder",
"params": {},
"custom": {},
"header": {
"Content-Type": "application/json;charset=UTF-8",
"Auth-Token": null,
"Root-Scope": null
},
"validateStatus": "function() { [native code] }",
"data": {
"merchantId": "",
"startDate": "",
"endDate": "",
"status": "",
"type": "transport",
"userId": "no_login_user",
"operatorUserId": "no_login_user",
"customerId": null,
"serviceId": null,
"requestId": "b2580456a73126124d8563a29827c570"
},
"timeout": 20000,
"dataType": "json",
"responseType": "text",
"sslVerify": false,
"firstIpv4": false,
"fullPath": "http://127.0.0.1:8080/api/distribution/facade/loadDistributionOrder"
}
}
解决办法
把请求地址127.0.0.1 改为自己本机ipv4的地址
具体方法(mac电脑)