Skip to content

Commit d3242a3

Browse files
committed
Add test for #5
1 parent f386c8d commit d3242a3

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

example/integration.js

100644100755
File mode changed.

test/mocha/integration/echo.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ describe('echo Server', function setup() {
154154
});
155155

156156
it('should answer with the request querystring', function checkResponse(done) {
157-
var requestPath = '/query/somthing';
157+
var requestPath = '/query/something';
158158

159159
request({
160160
baseUrl : 'http://localhost:' + port,
@@ -193,6 +193,29 @@ describe('echo Server', function setup() {
193193
});
194194
});
195195

196+
it('should answer with correct request header names', function checkResponse(done) {
197+
var hdr1 = 'test1',
198+
hdr2 = 'test2';
199+
200+
request({
201+
uri: 'http://localhost:' + port,
202+
method: 'GET',
203+
headers: {
204+
'x_testhdr': hdr1, // XXX: Using underscores because fcgi-handler
205+
'x_test_hdr': hdr2 // passes hyphens in CGI params
206+
}
207+
}, function (err, res, body) {
208+
expect(res.statusCode).to.be.equal(200);
209+
expect(res.headers['content-type']).to.be.equal('application/json; charset=utf-8');
210+
211+
var echo = JSON.parse(body);
212+
expect(echo).to.have.deep.property('headers.x-testhdr', hdr1);
213+
expect(echo).to.have.deep.property('headers.x-test-hdr', hdr2);
214+
215+
done(err);
216+
});
217+
});
218+
196219
after(function removeSocketPath(done) {
197220
require('fs').unlink(socketPath, done);
198221
});

0 commit comments

Comments
 (0)