Permalink
Browse files

[dist] s/){/) {/ s/function(/function (/.

  • Loading branch information...
1 parent bc615fb commit b15394afd1bc80efd066ea0d2657fa6b8c546113 @indexzero indexzero committed Nov 20, 2013
View
@@ -54,10 +54,10 @@ router.post(/foo/, { stream: true }, function () {
var req = this.req,
res = this.res,
writeStream;
-
+
writeStream = fs.createWriteStream(Date.now() + '-foo.txt');
req.pipe(writeStream);
-
+
writeStream.on('close', function () {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('wrote to a stream!');
@@ -85,7 +85,7 @@ var app = connect()
.use(connect.directory('public'))
.use(connect.cookieParser('my secret here'))
.use(connect.session())
- .use(function(req, res){
+ .use(function (req, res) {
res.end('Hello from Connect!\n');
});
@@ -107,7 +107,7 @@ var server = union.createServer({
connect.directory('public'),
connect.cookieParser('my secret here'),
connect.session(),
- function(req, res) {
+ function (req, res) {
res.end('Hello from Connect!\n');
},
]
@@ -128,32 +128,32 @@ Specification
```
function createServer(options)
- @param options {Object}
+ @param options {Object}
An object literal that represents the configuration for the server.
-
- @option before {Array}
- The `before` value is an array of middlewares, which are used to route and serve incoming
- requests. For instance, in the example, `favicon` is a middleware which handles requests
+
+ @option before {Array}
+ The `before` value is an array of middlewares, which are used to route and serve incoming
+ requests. For instance, in the example, `favicon` is a middleware which handles requests
for `/favicon.ico`.
- @option after {Array}
+ @option after {Array}
The `after` value is an array of functions that return stream filters,
- which are applied after the request handlers in `options.before`.
- Stream filters inherit from `union.ResponseStream`, which implements the
+ which are applied after the request handlers in `options.before`.
+ Stream filters inherit from `union.ResponseStream`, which implements the
Node.js core streams api with a bunch of other goodies.
- @option limit {Object}
+ @option limit {Object}
(optional) A value, passed to internal instantiations of `union.BufferedStream`.
- @option https {Object}
- (optional) A value that specifies the certificate and key necessary to create an instance of
+ @option https {Object}
+ (optional) A value that specifies the certificate and key necessary to create an instance of
`https.Server`.
- @option spdy {Object}
- (optional) A value that specifies the certificate and key necessary to create an instance of
+ @option spdy {Object}
+ (optional) A value that specifies the certificate and key necessary to create an instance of
`spdy.Server`.
- @option headers {Object}
+ @option headers {Object}
(optional) An object representing a set of headers to set in every outgoing response
```
@@ -187,7 +187,7 @@ An example of the `headers` option.
``` js
{
- 'x-powered-by': 'your-sweet-application v10.9.8'
+ 'x-powered-by': 'your-sweet-application v10.9.8'
}
```
@@ -221,8 +221,8 @@ Specification
```
function BufferedStream(limit)
-
- @param limit {Number}
+
+ @param limit {Number}
the limit for which the stream can be buffered
```
@@ -265,7 +265,7 @@ Example
```js
httpStream.headers = '';
-```
+```
### method
The HTTP method ("GET", "POST", etc).
@@ -31,8 +31,8 @@ var icon;
* @return {String}
* @api public
*/
-
-exports.md5 = function(str, encoding){
+
+exports.md5 = function (str, encoding) {
return crypto
.createHash('md5')
.update(str)
@@ -50,11 +50,11 @@ exports.md5 = function(str, encoding){
* Examples:
*
* connect.createServer(
- * connect.favicon()
+ * connect.favicon()
* );
*
* connect.createServer(
- * connect.favicon(__dirname + '/public/favicon.ico')
+ * connect.favicon(__dirname + '/public/favicon.ico')
* );
*
* @param {String} path
@@ -63,18 +63,18 @@ exports.md5 = function(str, encoding){
* @api public
*/
-module.exports = function favicon(path, options){
+module.exports = function favicon(path, options) {
var options = options || {}
, path = path || __dirname + '/../public/favicon.ico'
, maxAge = options.maxAge || 86400000;
- return function favicon(req, res, next){
+ return function favicon(req, res, next) {
if ('/favicon.ico' == req.url) {
if (icon) {
res.writeHead(200, icon.headers);
res.end(icon.body);
} else {
- fs.readFile(path, function(err, buf){
+ fs.readFile(path, function (err, buf) {
if (err) return next(err);
icon = {
headers: {
@@ -17,10 +17,10 @@ GzipDecode.prototype.decode = function (source) {
source.pipe(this.decoder);
}
-GzipDecoderStack.prototype._onGunzipData = function(chunk) {
+GzipDecoderStack.prototype._onGunzipData = function (chunk) {
this.emit('data', chunk);
}
-GzipDecoderStack.prototype._onGunzipEnd = function() {
+GzipDecoderStack.prototype._onGunzipEnd = function () {
this.emit('end');
}
@@ -27,21 +27,21 @@ router.post('/foo', { stream: true }, function () {
var req = this.req,
res = this.res,
writeStream;
-
+
writeStream = fs.createWriteStream(__dirname + '/' + Date.now() + '-foo.txt');
req.pipe(writeStream);
-
+
writeStream.on('close', function () {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('wrote to a stream!');
});
});
-router.get('/redirect', function() {
+router.get('/redirect', function () {
this.res.redirect('http://www.google.com');
});
-router.get('/custom_redirect', function() {
+router.get('/custom_redirect', function () {
this.res.redirect('/foo', 301);
});
@@ -1,5 +1,5 @@
-// In order to run this example you need to
-// generate local ssl certificate
+// In order to run this example you need to
+// generate local ssl certificate
var union = require('../../lib'),
director = require('director');
@@ -25,6 +25,6 @@ router.get(/foo/, function () {
this.res.end('hello world\n');
});
-server.listen(9090, function(){
+server.listen(9090, function () {
console.log('union with director running on 9090 with SPDY');
});
@@ -22,9 +22,9 @@ server.listen(9090);
var io = require('socket.io').listen(server);
-io.sockets.on('connection', function(socket) {
+io.sockets.on('connection', function (socket) {
socket.emit('news', {hello: 'world'});
- socket.on('my other event', function(data) {
+ socket.on('my other event', function (data) {
console.log(data);
});
});
@@ -59,7 +59,7 @@ Object.defineProperty(BufferedStream.prototype, 'buffer', {
BufferedStream.prototype.pipe = function () {
var self = this,
dest;
-
+
if (self.resume) {
self.resume();
}
@@ -128,13 +128,13 @@ BufferedStream.prototype.close = function () {
};
if (!stream.Stream.prototype.pause) {
- BufferedStream.prototype.pause = function() {
+ BufferedStream.prototype.pause = function () {
this.emit('pause');
};
}
if (!stream.Stream.prototype.resume) {
- BufferedStream.prototype.resume = function() {
+ BufferedStream.prototype.resume = function () {
this.emit('resume');
};
}
View
@@ -84,7 +84,7 @@ core.createServer = function (options) {
});
}
- if (options.spdy){
+ if (options.spdy) {
// spdy is optional so we require module here rather than on top
var spdy = require('spdy');
return spdy.createServer(credentials, requestHandler);
@@ -161,7 +161,7 @@ ResponseStream.prototype.write = function (data) {
}
};
-ResponseStream.prototype.redirect = function(path, status) {
+ResponseStream.prototype.redirect = function (path, status) {
var url = '';
if (~path.indexOf('://')) {
View
@@ -11,15 +11,15 @@ vows.describe('union/header').addBatch({
var server = union.createServer({
before: [
function (req, res) {
- res.on('header', function() {
+ res.on('header', function () {
callback(null, res);
});
res.writeHead(200, { 'content-type': 'text' });
res.end();
}
]
});
- server.listen(9092, function() {
+ server.listen(9092, function () {
request('http://localhost:9092/');
});
},
View
@@ -18,7 +18,7 @@ vows.describe('union/properties').addBatch({
}
]
});
- server.listen(9092, function() {
+ server.listen(9092, function () {
request('http://localhost:9092/');
});
},
View
@@ -50,31 +50,31 @@ vows.describe('union/simple').addBatch({
}
},
"a GET request to `/redirect`": {
- topic: function() {
+ topic: function () {
request.get({
url: 'http://localhost:9090/redirect',
followRedirect: false
}, this.callback);
},
- "it should redirect to `http://www.google.com`": function(err, res, body) {
+ "it should redirect to `http://www.google.com`": function (err, res, body) {
assert.equal(res.statusCode, 302);
assert.equal(res.headers.location, "http://www.google.com");
}
},
"a GET request to `/custom_redirect`": {
- topic: function() {
+ topic: function () {
request.get({
url: 'http://localhost:9090/custom_redirect',
followRedirect: false
}, this.callback);
},
- "it should redirect to `/foo`": function(err, res, body) {
+ "it should redirect to `/foo`": function (err, res, body) {
assert.equal(res.statusCode, 301);
assert.equal(res.headers.location, "http://localhost:9090/foo");
}
},
"a GET request to `/async`": {
- topic: function() {
+ topic: function () {
request.get({
url: 'http://localhost:9090/async',
timeout: 500

0 comments on commit b15394a

Please sign in to comment.