2

我目前正在为 Corona 开发一个 bugsense 插件。执行请求的函数是:

local function sendLog(request) 
    local headers = {}

    headers["Content-Type"] = "application/json"
    headers["X-BugSense-Api-Key"] = "XXXXXXXXX"

    local params = {}
    params.headers = headers

    params.body =json.encode(request)

    network.request( "http://www.bugsense.com/api/errors", "POST", networkListener, params)
end

请求完美执行,但 API 返回以下错误:

{
    "data": null,
    "error": "list index out of range"
}

发送给 BUgsense 的请愿书是:

{
    "client": {
        "name": "bugsense-ios",
        "version": "0.6"
    },
    "exception": {
        "message": "XXXX",
        "klass": "",
        "where": "",
        "backtrace": "XXXXX"
    },
    "application_environment": {
        "appver": "2.0",
        "uid": "XXXXX",
        "mobile_net_on": "false",
        "phone": "iPad",
        "appname": "app",
        "wifi_on": "false",
        "osver": "10.9"
    }
}

显然,所有的XXXXX都是在替换敏感信息。

任何人都可以帮助我解决发出该错误消息的请求中有什么问题吗?

提前致谢

4

2 回答 2

2

Answering my own question for future references

The issue was generated because not all fields were included. All the fields in exception group must be included and non-empty. Even if the instructions from Bugsense are not indicating them as mandatory.

Hope this helps

于 2014-06-02T08:32:06.373 回答
0

不知道这是否可行,但如果你卡住了,值得一试:尝试用数字而不是字符串索引标题。

headers[1] = "application/json"
headers[2] = "XXXXXXXXX"
于 2014-05-31T15:57:10.000 回答