Skip to content

Instantly share code, notes, and snippets.

@danielb2
Last active September 29, 2015 03:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielb2/78309eaf53d533407642 to your computer and use it in GitHub Desktop.
Save danielb2/78309eaf53d533407642 to your computer and use it in GitHub Desktop.
despite dependency setting, this fail to work in hapi 9.x and node 4.x
exports.register = function (server, options, next) {
server.dependency(['h2o2']);
server.route({
method: 'GET',
path: '/{url*}',
config: {
handler: {
proxy: {
host: 'www.google.com',
}
}
}
});
return next();
};
exports.register.attributes = {
name: 'plugin',
version: '1.0.0'
};
// Load libraries
var Code = require('code');
var Glue = require('glue');
var Lab = require('lab');
// Test shortcuts
var lab = exports.lab = Lab.script();
var describe = lab.describe;
var it = lab.it;
var expect = Code.expect;
var internals = {};
describe('with glue', function () {
it('fails to load dependency', function (done) {
var manifest = {
plugins: {
'./plugin': {},
h2o2: {},
vision: {}
}
};
Glue.compose(manifest, { relativeTo: __dirname }, function (err, server) {
if (err) {
return callback(err);
}
server.inject('/intl/en/about/', function (res) {
expect(res.statusCode).to.equal(200);
done();
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment