我对WSO2工具非常陌生。我最近开始使用WSO2 API管理器(Ver)。3.1.0)。我通过导入httpbin swagger规范:https://github.com/Azure/api-management-samples/blob/master/apis/httpbin.swagger.json创建了一个API网关。我发布了API,订阅了它,生成了API键并开始测试。
我在邮递员中导入规范,配置API密钥进行授权,将服务器更改为本地网关http://localhost:8280/Api_Base/1.0。
使用GET方法定义的所有资源都是可访问的,但不能通过网关访问POST、PUT和修补程序资源。对于这些资源,我收到了以下错误响应"<faultstring>unknown“。我也尝试过使用cURL,但是得到了同样的结果。当我直接为httpbin尝试POST时,它运行得很好:
curl --location --request POST 'http://httpbin.org/post'
{
"args": {},
"data": "",
"files": {},
"form": {},
"headers": {
"Accept": "*/*",
"Host": "httpbin.org",
"User-Agent": "curl/7.58.0",
"X-Amzn-Trace-Id": "Root=1-5e8e0d39-ddf21f1055008f60707cf150"
},
"json": null,
"origin": "95.103.xxx.xxx",
"url": "http://httpbin.org/post"
}并通过我的API网关(也使用API密钥):
curl --location --request POST 'http://localhost:8280/HTTP_Bin_Mock/1.0/post'
<faultstring>unknown</faultstring>有什么会出错的?
发布于 2020-04-11 14:31:44
请尝试以下CURL命令
curl --location --request POST 'http://localhost:8280/HTTP_Bin_Mock/1.0/post' --data '{}' --header 'Content-Type: Application/JSON'https://stackoverflow.com/questions/61106914
复制相似问题