Skip to content

Commit 8d86826

Browse files
committed
fix lint
1 parent cf61f71 commit 8d86826

File tree

4 files changed

+28
-29
lines changed

4 files changed

+28
-29
lines changed

examples/hapi.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,22 @@ const Hapi = require('hapi');
66
// Create a server with a host and port
77
const server = new Hapi.Server();
88
server.connection({
9-
host: 'localhost',
10-
port: 8080
9+
host: 'localhost',
10+
port: 8080
1111
});
1212

1313
server.register(miniprofiler.hapi(), (err) => {
14-
if (err) console.error('Failed to load plugin:', err);
14+
if (err) throw err;
1515
});
1616

1717
server.route({
1818
method: 'GET',
1919
path:'/hello',
20-
handler: function (request, reply) {
20+
handler: function(request, reply) {
2121
return reply('<html><body>hello' + request.raw.req.miniprofiler.include() + '</body></html>');
2222
}
2323
});
2424

2525
server.start((err) => {
26-
if (err) throw err;
27-
console.log('Server running at:', server.info.uri);
26+
if (err) throw err;
2827
});

lib/middlewares/hapi.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
module.exports = function(f, profiler) {
22
if(!f) f = function() { return true; };
33
var plugin = {
4-
register: function (server, options, next) {
5-
server.ext('onRequest', function (request, reply) {
4+
register: function(server, options, next) {
5+
server.ext('onRequest', function(request, reply) {
66

77
profiler.configure();
88
var enabled = f(request.raw.req, request.raw.res);
@@ -45,12 +45,12 @@ module.exports = function(f, profiler) {
4545
request.raw.res.setHeader('X-MiniProfiler-Ids', `["${id}"]`);
4646
}
4747

48-
return reply.continue();
48+
return reply.continue();
4949

50-
});
51-
next();
50+
});
51+
next();
5252
}
53-
}
53+
};
5454

5555
plugin.register.attributes = {
5656
name: 'miniprofiler-hapi',

tests/servers/hapi/default.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,46 +10,46 @@ server.connection({
1010
});
1111

1212
server.register(miniprofiler.hapi(), (err) => {
13-
if (err) console.error('Failed to load plugin:', err);
13+
if (err) throw err;
1414
});
1515

1616
server.route({
1717
method: 'GET',
1818
path:'/',
19-
handler: function (request, reply) {
19+
handler: function(request, reply) {
2020
return reply('');
2121
}
2222
});
2323

2424
server.route({
2525
method: 'GET',
2626
path:'/step',
27-
handler: function (request, reply) {
28-
request.raw.req.miniprofiler.step('Step 1', () => {
27+
handler: function(request, reply) {
28+
request.raw.req.miniprofiler.step('Step 1', () => {
2929
return reply('');
30-
});
30+
});
3131
}
3232
});
3333

3434
server.route({
3535
method: 'GET',
3636
path:'/step-two',
37-
handler: function (request, reply) {
38-
request.raw.req.miniprofiler.step('Step 1', () => {
39-
request.raw.req.miniprofiler.step('Step 2', () => {
40-
return reply('');
41-
});
42-
});
37+
handler: function(request, reply) {
38+
request.raw.req.miniprofiler.step('Step 1', () => {
39+
request.raw.req.miniprofiler.step('Step 2', () => {
40+
return reply('');
41+
});
42+
});
4343
}
4444
});
4545

4646
server.route({
4747
method: 'GET',
4848
path:'/js-sleep',
49-
handler: function (request, reply) {
50-
request.raw.req.miniprofiler.timeQuery('custom', 'Sleeping...', setTimeout, function() {
51-
return reply('');
52-
}, 50);
49+
handler: function(request, reply) {
50+
request.raw.req.miniprofiler.timeQuery('custom', 'Sleeping...', setTimeout, function() {
51+
return reply('');
52+
}, 50);
5353
}
5454
});
5555

tests/servers/hapi/unprofiled.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ var disableMiniProfiler = (req) => {
1414
};
1515

1616
server.register(miniprofiler.hapi(disableMiniProfiler), (err) => {
17-
if (err) console.error('Failed to load plugin:', err);
17+
if (err) throw (err);
1818
});
1919

2020
server.route({
2121
method: 'GET',
2222
path:'/',
23-
handler: function (request, reply) {
23+
handler: function(request, reply) {
2424
return reply('');
2525
}
2626
});

0 commit comments

Comments
 (0)