Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Avatar for KuCalc : devops.
Download
50675 views
1
/*
2
* stream-test.js: Tests for streaming HTTP in director.
3
*
4
* (C) 2011, Nodejitsu Inc.
5
* MIT LICENSE
6
*
7
*/
8
9
var assert = require('assert'),
10
http = require('http'),
11
vows = require('vows'),
12
request = require('request'),
13
director = require('../../../lib/director'),
14
helpers = require('../helpers'),
15
macros = helpers.macros,
16
handlers = helpers.handlers
17
18
vows.describe('director/http/stream').addBatch({
19
"An instance of director.http.Router": {
20
"with streaming routes": {
21
topic: function () {
22
var router = new director.http.Router();
23
router.post(/foo\/bar/, { stream: true }, handlers.streamBody);
24
return router;
25
},
26
"when passed to an http.Server instance": {
27
topic: function (router) {
28
helpers.createServer(router)
29
.listen(9092, this.callback);
30
},
31
"a POST request to foo/bar": macros.assertPost(9092, 'foo/bar', {
32
foo: 'foo',
33
bar: 'bar'
34
})
35
}
36
}
37
}
38
}).export(module);
39