Skip to content

Commit d35cbd4

Browse files
committed
tests: add test for writeHead without arguments
1 parent 646a914 commit d35cbd4

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function setWriteHeadHeaders(statusCode) {
6060
? 2
6161
: 1
6262

63-
var headers = length >= headerIndex - 1
63+
var headers = length >= headerIndex + 1
6464
? arguments[headerIndex]
6565
: undefined
6666

test/test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,18 @@ describe('onHeaders(res, listener)', function () {
154154
.expect('X-Status', '201')
155155
.expect(202, done)
156156
})
157+
158+
it('should pass-through core error', function (done) {
159+
var server = createServer(echoListener, handler)
160+
161+
function handler(req, res) {
162+
res.writeHead() // error
163+
}
164+
165+
request(server)
166+
.get('/')
167+
.expect(500, done)
168+
})
157169
})
158170

159171
describe('writeHead(status, reason)', function () {

0 commit comments

Comments
 (0)