File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 593593--
594594--
595595function ServerResponse :writeHead (statusCode , reasonPhrase , headers )
596- local headers , headerIndex
596+ local headerIndex
597597
598598 if type (reasonPhrase ) == " table" then
599599 headers = reasonPhrase
Original file line number Diff line number Diff line change 1+ ---
2+ -- Test for https://github.com/ignacio/LuaNode/issues/14
3+ --
4+ -- response:writeHead with a status reason ignores headers
5+ --
6+
7+ module (... , lunit .testcase , package.seeall )
8+
9+ local common = dofile " common.lua"
10+ local http = require " luanode.http"
11+
12+ function test ()
13+
14+ local server = http .createServer (function (self , req , res )
15+ res :writeHead (200 , " Some custom status" , {[" Content-Type" ] = " text/plain" })
16+ res :finish (" hello there" )
17+ self :close ()
18+ end )
19+
20+
21+ server :listen (common .PORT , function ()
22+ local client = http .createClient (common .PORT )
23+ local request = client :request (" GET" , " /" )
24+ request :finish ()
25+ request :on (" response" , function (self , response )
26+ assert_equal (response .headers [" content-type" ], " text/plain" )
27+ end )
28+ end )
29+
30+ process :loop ()
31+ end
You can’t perform that action at this time.
0 commit comments