@@ -10,16 +10,19 @@ describe("http.stream_common", function()
1010 c = h1_connection .new (c , " client" , version )
1111 return s , c
1212 end
13+ local function new_request_headers ()
14+ local headers = new_headers ()
15+ headers :append (" :authority" , " myauthority" )
16+ headers :append (" :method" , " GET" )
17+ headers :append (" :path" , " /" )
18+ return headers
19+ end
1320 it (" Can read a number of characters" , function ()
1421 local server , client = new_pair (1.1 )
1522 local cq = cqueues .new ()
1623 cq :wrap (function ()
1724 local stream = client :new_stream ()
18- local headers = new_headers ()
19- headers :append (" :authority" , " myauthority" )
20- headers :append (" :method" , " GET" )
21- headers :append (" :path" , " /" )
22- assert (stream :write_headers (headers , false ))
25+ assert (stream :write_headers (new_request_headers (), false ))
2326 assert (stream :write_chunk (" foo" , false ))
2427 assert (stream :write_chunk (" \n b" , false ))
2528 assert (stream :write_chunk (" ar\n " , true ))
@@ -47,11 +50,7 @@ describe("http.stream_common", function()
4750 local cq = cqueues .new ()
4851 cq :wrap (function ()
4952 local stream = client :new_stream ()
50- local headers = new_headers ()
51- headers :append (" :authority" , " myauthority" )
52- headers :append (" :method" , " GET" )
53- headers :append (" :path" , " /" )
54- assert (stream :write_headers (headers , false ))
53+ assert (stream :write_headers (new_request_headers (), false ))
5554 assert (stream :write_chunk (" foo" , false ))
5655 assert (stream :write_chunk (" \n b" , false ))
5756 assert (stream :write_chunk (" ar\n " , true ))
@@ -72,11 +71,7 @@ describe("http.stream_common", function()
7271 local cq = cqueues .new ()
7372 cq :wrap (function ()
7473 local stream = client :new_stream ()
75- local headers = new_headers ()
76- headers :append (" :authority" , " myauthority" )
77- headers :append (" :method" , " GET" )
78- headers :append (" :path" , " /" )
79- assert (stream :write_headers (headers , false ))
74+ assert (stream :write_headers (new_request_headers (), false ))
8075 assert (stream :write_chunk (" hello world!" , true ))
8176 end )
8277 cq :wrap (function ()
@@ -97,11 +92,7 @@ describe("http.stream_common", function()
9792 assert (file :write (" hello world!" ))
9893 assert (file :seek (" set" ))
9994 local stream = client :new_stream ()
100- local headers = new_headers ()
101- headers :append (" :authority" , " myauthority" )
102- headers :append (" :method" , " GET" )
103- headers :append (" :path" , " /" )
104- assert (stream :write_headers (headers , false ))
95+ assert (stream :write_headers (new_request_headers (), false ))
10596 assert (stream :write_body_from_file (file ))
10697 end )
10798 cq :wrap (function ()
0 commit comments