File tree Expand file tree Collapse file tree 1 file changed +58
-0
lines changed Expand file tree Collapse file tree 1 file changed +58
-0
lines changed Original file line number Diff line number Diff line change 1+ use Test::Nginx::Socket ' no_plan' ;
2+ use Cwd qw( cwd) ;
3+
4+ my $pwd = cwd();
5+
6+ $ENV {TEST_NGINX_RESOLVER } = ' 8.8.8.8' ;
7+ $ENV {TEST_NGINX_PWD } ||= $pwd ;
8+ $ENV {TEST_COVERAGE } ||= 0;
9+
10+ our $HttpConfig = qq{
11+ lua_package_path "$pwd /lib/?.lua;/usr/local/share/lua/5.1/?.lua;;";
12+ error_log logs/error.log debug;
13+ resolver 8.8.8.8;
14+
15+ init_by_lua_block {
16+ if $ENV {TEST_COVERAGE} == 1 then
17+ jit.off()
18+ require("luacov.runner").init()
19+ end
20+ }
21+ } ;
22+
23+ no_long_string();
24+ run_tests();
25+
26+ __DATA__
27+ === TEST 1: Old connect syntax still works
28+ --- http_config eval: $::HttpConfig
29+ --- config
30+ location /a {
31+ content_by_lua_block {
32+ local http = require "resty.http"
33+ local httpc = http.new()
34+ local ok, err = httpc:connect("127.0.0.1", ngx.var.server_port)
35+ assert(ok, err)
36+
37+ local res, err = httpc:request{
38+ path = "/b"
39+ }
40+
41+ ngx.status = res.status
42+ ngx.print(res:read_body())
43+
44+ httpc:close()
45+ }
46+ }
47+ location = /b {
48+ echo "OK";
49+ }
50+ --- request
51+ GET /a
52+ --- response_body
53+ OK
54+ --- no_error_log
55+ [error]
56+ [warn]
57+ --- error_log
58+ [debug]
You can’t perform that action at this time.
0 commit comments