Hello, 错误提示很明显嘛 按照你这样的写法,请求行是以下这样的, 显然不符合HTTP协议 meth [url [version]]
GET /trim_left?str0=" xxx"&str1=" x x y "&str2=" " HTTP/1.0
建议改成转义之后
GET /trim_left?str0=" xxx"&str1=" x x y "&str2=" " HTTP/1.0
TO
GET /trim_left?str0=%20%20xxx&str1=%20%20%20x%20x%20y%20&str2=%20%20%20 HTTP/1.0
在 2016年8月2日星期二 UTC+8下午2:07:49,xiaoyao Wu写道:
hi,我用Test::Nginx测试一个lua函数,
想通过request一次性传入三个测试数据,代码(test_str.lua)如下: 54 === TEST 3: lua_file
55 --- http_config eval: $::HttpConfig
56 --- config
57 location /trim_left {
58 content_by_lua_file /usr/home/local/nginx_work/src/utility/test_str.lua;
59 }
60 --- request
61 GET /trim_left?str0=" xxx"&str1=" x x y "&str2=" " HTTP/1.0
62 --- response_body
63 ok, right
64 --- error_code: 200
当我运行perl t/test.t时有如下错误:
Bail out! TEST 3: lua_file - Request line is not valid. Should be 'meth [url [version]]' but got "GET /trim_left?str0=" xxx"&str1=" x x y "&str2=" " HTTP/1.0
为什么?
另外,官方文档中request有这个用法:
--- request
GET /t?a=1&b=2 HTTP/1.0