Sha256: 1af5eadd04a2b0f9362e30546bf7f54d81184d842ddc45356ca62e6515f86de0

Contents?: true

Size: 1.24 KB

Versions: 26

Compression:

Stored size: 1.24 KB

Contents

/**
 * Module dependencies.
 */

var connect = require('connect'),
    helpers = require('./helpers'),
    assert = require('assert'),
    http = require('http');

module.exports = {
    test: function(){
        var server = helpers.run(
            connect.vhost('foo.com', connect.createServer(
                function(req, res){
                    res.writeHead(200, {});
                    res.end('from foo');
                }
            )),
            connect.vhost('bar.com', connect.createServer(
                function(req, res){
                    res.writeHead(200, {});
                    res.end('from bar');
                }
            ))
        );

        var req = server.request('GET', '/', { Host: 'foo.com' });
        req.buffer = true;
        req.addListener('response', function(res){
            res.addListener('end', function(){
                assert.equal('from foo', res.body);
            });
        });
        req.end();

        var req = server.request('GET', '/', { Host: 'bar.com' });
        req.buffer = true;
        req.addListener('response', function(res){
            res.addListener('end', function(){
                assert.equal('from bar', res.body);
            });
        });
        req.end();
    }
}

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
vulcan-0.8.2 server/node_modules/connect-form/support/connect/test/vhost.test.js
vulcan-0.8.1 server/node_modules/connect-form/support/connect/test/vhost.test.js
vulcan-0.8.0 server/node_modules/connect-form/support/connect/test/vhost.test.js
vulcan-0.7.2 server/node_modules/connect-form/support/connect/test/vhost.test.js
vulcan-0.7.1 server/node_modules/connect-form/support/connect/test/vhost.test.js
vulcan-0.7.0 server/node_modules/connect-form/support/connect/test/vhost.test.js
vulcan-0.6.1 server/node_modules/connect-form/support/connect/test/vhost.test.js
vulcan-0.6.0 server/node_modules/connect-form/support/connect/test/vhost.test.js
vulcan-0.5.0 server/node_modules/connect-form/support/connect/test/vhost.test.js
vulcan-0.4.0 server/node_modules/connect-form/support/connect/test/vhost.test.js
vulcan-0.3.0 server/node_modules/connect-form/support/connect/test/vhost.test.js
vulcan-0.2.5 server/node_modules/connect-form/support/connect/test/vhost.test.js
vulcan-0.2.4 server/node_modules/connect-form/support/connect/test/vhost.test.js
vulcan-0.2.3 server/node_modules/connect-form/support/connect/test/vhost.test.js
vulcan-0.2.2 server/node_modules/connect-form/support/connect/test/vhost.test.js
vulcan-0.2.1 server/node_modules/connect-form/support/connect/test/vhost.test.js
vulcan-0.2.0 server/node_modules/connect-form/support/connect/test/vhost.test.js
vulcan-0.1.6 server/node_modules/connect-form/support/connect/test/vhost.test.js
vulcan-0.1.5 server/node_modules/connect-form/support/connect/test/vhost.test.js
vulcan-0.1.4 server/node_modules/connect-form/support/connect/test/vhost.test.js