Skip to content

Commit

Permalink
Merge pull request #12 from jmlue42/master
Browse files Browse the repository at this point in the history
Updating to Hapi 11.x.x
  • Loading branch information
mac- committed Nov 18, 2015
2 parents 3cff314 + bcccb73 commit f7381f5
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -3,3 +3,4 @@
node_modules
test/coverage*
.DS*
.idea/
2 changes: 1 addition & 1 deletion .travis.yml
@@ -1,3 +1,3 @@
language: node_js
node_js:
- 0.10
- 4
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -110,7 +110,7 @@ server.statsd.set('your.set', 200);

## Version Compatibility

### Currently compatible with: Hapi 10.x.x (Node v4)
### Currently compatible with: Hapi 11.x.x (Node v4)

* 0.1.x - Hapi 1.x.x
* 0.2.x - Hapi 3.x.x
Expand All @@ -121,6 +121,7 @@ server.statsd.set('your.set', 200);
* 1.2.x - Hapi 8.x.x
* 2.x.x - Hapi 9.x.x
* 3.x.x - Hapi 10.x.x (Node v4)
* 4.x.x - Hapi 11.x.x

# License

Expand Down
3 changes: 3 additions & 0 deletions lib/hapi-statsd.js
Expand Up @@ -48,6 +48,9 @@ module.exports.register = function (server, options, next) {
else if (specials.options && request._route === specials.options.route) {
path = '/{cors*}';
}
else if (request._route.path === '/' && request._route.method === 'options'){
path = '/{cors*}';
}

var statName = settings.template
.replace('{path}', normalizePath(path))
Expand Down
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -4,7 +4,7 @@
"contributors": [
"Mac Angell <mac.ang311@gmail.com>"
],
"version": "3.0.0",
"version": "4.0.0",
"dependencies": {
"statsd-client": "0.x.x",
"eidetic": "0.x.x",
Expand All @@ -16,12 +16,12 @@
"travis-cov": "0.x.x",
"blanket": "1.x.x",
"node-dependencies": "0.x.x",
"hapi": "^10.0.0",
"hapi": "^11.0.0",
"coveralls": "2.x.x",
"mocha-lcov-reporter": "0.x.x"
},
"peerDependencies": {
"hapi": "^10.0.0"
"hapi": "^11.0.0"
},
"keywords": [
"hapi",
Expand Down
9 changes: 4 additions & 5 deletions test/integration/hapi-statsd.tests.js
Expand Up @@ -22,8 +22,7 @@ beforeEach(function(done) {

server.connection({
host: 'localhost',
port: 8085,
routes: { cors: true }
port: 8085
});

var get = function (request, reply) {
Expand All @@ -34,9 +33,9 @@ beforeEach(function(done) {
reply(new Error());
};

server.route({ method: 'GET', path: '/', handler: get });
server.route({ method: 'GET', path: '/err', handler: err });
server.route({ method: 'GET', path: '/test/{param}', handler: get });
server.route({ method: ['GET','OPTIONS'], path: '/', handler: get, config: {cors: true}});
server.route({ method: 'GET', path: '/err', handler: err, config: {cors: true} });
server.route({ method: 'GET', path: '/test/{param}', handler: get, config: {cors: true}});

server.register({
register: plugin,
Expand Down

0 comments on commit f7381f5

Please sign in to comment.