回送js无法读取url中的GET请求参数

时间:2019-02-22 11:32:13

标签: loopbackjs

我有以下代码:

Addresses.getorderHistory = function(address, baseToken, status, length, cb) {
            console.log("lenght here -> " + length);
            addressService.getorderHistory(address, baseToken, status, length, cb)
                .catch(err => cb(err));
            };

Addresses.remoteMethod('getorderHistory', {
            http: { verb: 'get', path: '/:address/orderHistory' },
            accepts: [
                            { arg: "address", type: "string", required: true },
                            { arg: "base_token", type: "string", required: true, 'http': {source: 'query'} },
                            { arg: "status", type: "string", required: true, 'http': {source: 'query'} },
                            { arg: "length", type: "string", required: true, 'http': {source: 'query'} }
                    ],
            returns: { type: 'object', root: true }
            });

当我这样请求时

curl http://localhost:3001/<my root>/addresses/<my address>/orderHistory?base_token=<my token>&status=filled&length=100

它说

Error: status is a required argument

我基本上可以读取addressbaseToken的值,但不能读取statuslength。我想念什么?

0 个答案:

没有答案