孔:如何按服务和限制大小列出路线?

时间:2018-09-23 16:21:37

标签: http lua kong

我正在尝试列出服务的所有路线并限制返回尺寸:

"GET /services/get-headers/routes?size=3 HTTP/1.1", host: "localhost:8001"

但是我收到一条错误消息:

/usr/local/share/lua/5.1/kong/api/endpoints.lua:122: size must be a number

我非常相信这是一个错误,但是我对Lua的了解还不足以调试Kong源代码。有人知道我该怎么做吗?

完整堆栈跟踪:

2018/09/23 16:07:35 [error] 64#0: *1056076 lua coroutine: runtime error: /usr/local/share/lua/5.1/kong/api/endpoints.lua:122: size must be a number
stack traceback:
coroutine 0:
    [C]: in function 'error'
    /usr/local/share/lua/5.1/kong/db/dao/init.lua:48: in function </usr/local/share/lua/5.1/kong/db/dao/init.lua:41>
    /usr/local/share/lua/5.1/kong/api/endpoints.lua:122: in function </usr/local/share/lua/5.1/kong/api/endpoints.lua:111>
coroutine 1:
    [C]: in function 'resume'
    /usr/local/share/lua/5.1/lapis/application.lua:393: in function 'handler'
    /usr/local/share/lua/5.1/lapis/application.lua:130: in function 'resolve'
    /usr/local/share/lua/5.1/lapis/application.lua:161: in function </usr/local/share/lua/5.1/lapis/application.lua:159>
    [C]: in function 'xpcall'
    /usr/local/share/lua/5.1/lapis/application.lua:159: in function 'dispatch'
    /usr/local/share/lua/5.1/lapis/nginx.lua:215: in function 'serve_admin_api'
    content_by_lua(nginx-kong.conf:175):2: in function <content_by_lua(nginx-kong.conf:175):1>, client: 172.22.0.1, server: kong_admin, request: "GET /services/get-headers/routes?size=3 HTTP/1.1", host: "localhost:8001"

1 个答案:

答案 0 :(得分:0)

https://docs.konghq.com/0.14.x/admin-api/#list-routes-associated-to-a-service并不表明size是接受的请求querystring参数。