File tree Expand file tree Collapse file tree 1 file changed +64
-0
lines changed Expand file tree Collapse file tree 1 file changed +64
-0
lines changed Original file line number Diff line number Diff line change @@ -523,3 +523,67 @@ response not fully read
523
523
-- - no_error_log
524
524
[error]
525
525
[warn ]
526
+
527
+ === TEST 10 Pooling connection immediately after creation should work
528
+ -- - http_config eval: $::HttpConfig
529
+ -- - config
530
+ location = /a {
531
+ content_by_lua '
532
+ local http = require "resty.http"
533
+ local httpc = http.new()
534
+ ngx.say(httpc:set_keepalive())
535
+ ' ;
536
+ }
537
+ --- request
538
+ GET /a
539
+ -- - response_body
540
+ 1
541
+ -- - no_error_log
542
+ [error]
543
+ [warn ]
544
+
545
+ === TEST 11 Reusing client still checks pooling is ready
546
+ -- - http_config eval: $::HttpConfig
547
+ -- - config
548
+ location = /a {
549
+ content_by_lua '
550
+ local http = require "resty.http"
551
+ local httpc = http.new()
552
+ httpc:connect({
553
+ scheme = "http",
554
+ host = "127.0.0.1",
555
+ port = ngx.var.server_port,
556
+ pool_only_after_response = true
557
+ })
558
+
559
+ local res, err = httpc:request{
560
+ path = "/b"
561
+ }
562
+
563
+ local body = res:read_body()
564
+
565
+ ngx.say(res.headers["Connection"])
566
+ ngx.say(httpc:set_keepalive())
567
+
568
+ res, err = httpc:request{
569
+ path = "/b"
570
+ }
571
+ local ok
572
+ ok, err = httpc:set_keepalive())
573
+ ngx.say(err)
574
+ ' ;
575
+ }
576
+ location = /b {
577
+ content_by_lua '
578
+ ngx.say("OK")
579
+ ' ;
580
+ }
581
+ -- - request
582
+ GET / a
583
+ -- - response_body
584
+ keep-alive
585
+ 1
586
+ response not fully read
587
+ -- - no_error_log
588
+ [error]
589
+ [warn ]
You can’t perform that action at this time.
0 commit comments