如何解决MFP JavaScript HTPP 适配器调用外部 url
我正在创建一个新的 Javascript Http 适配器,它假设从其他一些公共 api 中获取一些 json 对象,例如 api.first.org/data/v1/countries
我正在我的程序中编写以下代码,但出现错误
var input = {
method : 'get',returnedContentType : 'json',path : 'api.first.org/data/v1/countries'
};
return MFP.Server.invokeHttp(input);
我得到的错误是
{
"isSuccessful": false,"warnings": [],"errors": [
"Unexpected error in server,see logs"
],"info": []
}
当我检查服务器日志时,错误是
[WARNING ] FWLSE0319W: Backend response content type 'text/html' did not match the expected content type 'json',continue prossesing the response. The request and response headers and body: request:
/api.first.org/data/v1/countries
response:
Not Found
Date=Thu,03 Jun 2021 06:38:36 GMT
Content-Type=text/html
Transfer-Encoding=chunked
Connection=keep-alive
[ERROR ] FWLST0904E: Exception was thrown while invoking procedure: getConfig in adapter: MyAdapter
Failed to read the HTTP response to: /api.first.org/data/v1/countries
Failed to parse JSON string
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.19.4</center>
</body>
</html>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。