Skip to content

Commit 120bb2b

Browse files
committed
option to serve up favicon, defaults to serving 204
1 parent d714269 commit 120bb2b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
var fs = require('fs');
12
exports.register = function(server, options, next) {
23

34
server.route({
@@ -9,7 +10,10 @@ exports.register = function(server, options, next) {
910
}
1011
},
1112
handler: function(request, reply) {
12-
reply().code(200).type('image/x-icon');
13+
if (!options.path) {
14+
return reply().code(204).type('image/x-icon');
15+
}
16+
reply(null, fs.createReadStream(options.path)).code(200).type('image/x-icon');
1317
}
1418
});
1519

0 commit comments

Comments
 (0)