File tree Expand file tree Collapse file tree 2 files changed +41
-4
lines changed Expand file tree Collapse file tree 2 files changed +41
-4
lines changed Original file line number Diff line number Diff line change 104104[error]
105105[warn ]
106106
107+
107108=== TEST 3 : 100 Continue does not end requset
108109-- - http_config eval: $::HttpConfig
109110-- - config
Original file line number Diff line number Diff line change @@ -20,7 +20,43 @@ no_long_string();
2020run_tests();
2121
2222__DATA__
23- === TEST 1 : Test headers can be accessed in all cases
23+ === TEST 1 : Test header normalisation
24+ -- - http_config eval: $::HttpConfig
25+ -- - config
26+ location = /a {
27+ content_by_lua '
28+ local http_headers = require "resty.http_headers"
29+
30+ local headers = http_headers.new()
31+
32+ headers.x_a_header = "a"
33+ headers["x-b-header"] = "b"
34+ headers["X-C-Header"] = "c"
35+ headers["X_d-HEAder"] = "d"
36+
37+ ngx.say(headers["X-A-Header"])
38+ ngx.say(headers.x_b_header)
39+
40+ for k,v in pairs(headers) do
41+ ngx.say(k, ": ", v)
42+ end
43+ ' ;
44+ }
45+ --- request
46+ GET /a
47+ -- - response_body
48+ a
49+ b
50+ x-b-header: b
51+ x-a-header: a
52+ X -d-HEAder: d
53+ X -C-Header: c
54+ -- - no_error_log
55+ [error]
56+ [warn ]
57+
58+
59+ === TEST 2 : Test headers can be accessed in all cases
2460-- - http_config eval: $::HttpConfig
2561-- - config
2662 location = /a {
5894[warn ]
5995
6096
61- === TEST 2 : Test request headers are normalised
97+ === TEST 3 : Test request headers are normalised
6298-- - http_config eval: $::HttpConfig
6399-- - config
64100 location = /a {
70106 local res, err = httpc:request{
71107 path = "/b",
72108 headers = {
73- user_agent = "test_user_agent",
109+ ["uSeR-AgENT"] = "test_user_agent",
74110 },
75111 }
76112
77113 ngx.status = res.status
78- ngx.say (res:read_body())
114+ ngx.print (res:read_body())
79115
80116 httpc:close()
81117 ' ;
You can’t perform that action at this time.
0 commit comments