0

我正在创建一个新的 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>

4

0 回答 0