Firebase App中的Axios http请求 - 400错误请求

时间:2016-08-18 17:57:19

标签: javascript ajax rest firebase firebase-realtime-database

我使用axios版本0.13.1,如果我想获取带有orderBylimitToFirst参数的数据,我收到400 Bad请求错误。

使用此http请求,我收到400错误:

axios({
        method: 'get',
        url: 'https://tracker-ag.firebaseio.com/groups.json',
        params: {
            auth: AccessStore.getToken(),
            orderBy: "$key",
            limitToFirst: 2,
        }
    }).then(function (response) {
        responseHandler(USERS_GET, '', response.data);
    })
    .catch(function (error) {
        console.log("Error during fetching data " + error.message);
    });

没有orderBy和limitToFirst参数的http请求有效:

axios({
    method: 'get',
    url: 'https://tracker-ag.firebaseio.com/groups.json',
    params: {
        auth: AccessStore.getToken(),
    }
}).then(function (response) {
    responseHandler(USERS_GET, '', response.data);
})
.catch(function (error) {
    console.log("Error during fetching data " + error.message);
});

0 个答案:

没有答案