Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restful模式下 测试报错 #44

Closed
mind029 opened this issue Mar 25, 2016 · 6 comments
Closed

restful模式下 测试报错 #44

mind029 opened this issue Mar 25, 2016 · 6 comments

Comments

@mind029
Copy link

mind029 commented Mar 25, 2016

使用阿里云 性能测试 工具 测试 vanilla 。发现在使用 restful路由的 url 报500错误。使用简单路由这没有(注明:使用浏览器正常 访问restful 路由url都没这情况),这个情况是否是个bug?

请求头信息:
`概览

Request URL :
http://114.215.93.85/
Request Method : GET
Status Code : 500 Internal Server Error
响应头信息

Server :
openresty/1.9.7.2
Date :
Fri, 25 Mar 2016 07:44:25 GMT
Content-Type :
text/html; charset=UTF-8
Transfer-Encoding :
chunked
Connection :
keep-alive
Power-By :
Vanilla-0.1.0-rc4
请求头信息

Host :
114.215.93.85
Connection :
Keep-Alive
User-Agent :
PTS-HTTP-CLIENT`
响应信息:
"/usr/local/vanilla/vanilla/v/routes/restful.lua:34: bad argument #1 to 'ngxmatch' (string expected, got boolean)"

@idevz
Copy link
Owner

idevz commented Mar 25, 2016

@mind029 我看你用的是0.1.0-rc4版本,请确保以下几个问题:
1.确定你的/usr/local/vanilla/vanilla/v/routes/restful.lua是最新版,老版本有个bug#37已经修复,如果是此问题导致,可单独引用当前master的这个包即可,但是不建议全部升级,因为目前rc5版本还在新浪内测阶段。
2.项目根目录下面的config/restful.lua文件正确配置,比如你这里用GET方法请求http://114.215.93.85/,应该有如下配置:

local restful = {
    v1={},
    v={}
}

restful.v.GET = {
    {pattern = '/', controller = 'index', action = 'index'},
}
return restful

@idevz
Copy link
Owner

idevz commented Mar 25, 2016

@mind029 非常抱歉 我才发现,那个bug也是你报的。你看看你的配置没问题吧?

@mind029
Copy link
Author

mind029 commented Mar 25, 2016

配置是没有问题的。因为使用浏览器 访问都没问题。使用阿里云 性能测试 测试 简单路由是 正常的。就是restful下 所有url都报500错误,怀疑是不是阿里云没有按get方式来请求连接导致的(测试参数里面我已经设置是get方式请求)

@idevz
Copy link
Owner

idevz commented Mar 25, 2016

@mind029 只有一种可能,阿里云的GET请求里面没有Accept头,默认都会有的。

@idevz
Copy link
Owner

idevz commented Mar 25, 2016

@mind029 HTTP协议原则上是要传这个头的,来协商服务端到底要给客户端返回怎样的数据,我加了个判空,你可以更新下主分支的vanilla/v/routes/restful.lua文件再试试。

@mind029
Copy link
Author

mind029 commented Mar 26, 2016

是的,阿里云 性能测试工具 请求头 少了信息导致了 空引起的错误,你做了判断后 正常了。。非常感谢。

@idevz idevz closed this as completed Mar 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants