Skip to content

Commit 409c869

Browse files
committed
Fix up encoding failure
1 parent b03c616 commit 409c869

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

lib/fsm.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ FSM.prototype.respond = function(req, res, code, headers) {
148148
}
149149
res.res.statusCode = code;
150150
// TODO: write head breaks chunked encoding?
151+
// Content-Length
151152
// res.res.writeHead(code, res.headers);
152153
if (this.resource.finishRequest != null) {
153154
this.resource.finishRequest(req, res);
@@ -252,7 +253,7 @@ FSM.prototype.doChooseEncoding = function(provided, encoding) {
252253
if (match) accepted_encoding = accept;
253254
}
254255
// TODO: this is likely wrong
255-
if(!accepted_encoding || accepted_encoding === '*') {
256+
if(accepted_encoding === '*') {
256257
accepted_encoding = "identity";
257258
}
258259
return accepted_encoding;

test/encoding-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ vows.describe('FSM Encoding').addBatch({
6969
var encoding = fsm.doChooseEncoding(provided, acceptencoding);
7070
this.callback(true, encoding);
7171
},
72-
'choose identity': function (passed, charset) {
73-
assert.equal(charset, 'identity');
72+
'choose null': function (passed, charset) {
73+
assert.equal(charset, null);
7474
}
7575
}
7676
// check that * works against a lower q match

test/fsm-test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ function buildTest(test) {
8989
assert.notEqual(req, undefined, 'req is required');
9090
// TODO: Use path
9191
// TODO: Check headers
92+
if(res.statusCode() != test.checkStatus)
93+
console.log(res.trace);
9294
assert.equal(res.statusCode(), test.checkStatus);
9395
assert.deepEqual(res.trace, test.checkStack);
9496
}

0 commit comments

Comments
 (0)