Make sure it returns the png header.

This commit is contained in:
lucaswadedavis 2016-12-19 13:52:32 -08:00
parent 0e2d3258ab
commit 47ff425041

View file

@ -45,6 +45,7 @@ app.get('/', function(req, res) {
var width = 400;
var seed = uuid();
var canvas = composeImage(width, width, seed);
res.type('png');
res.end(canvas.toBuffer(), 'binary');
});
@ -52,6 +53,7 @@ app.get('/:width', function(req, res) {
var width = parseInt(req.params.width) || 400;
var seed = uuid();
var canvas = composeImage(width, width, seed);
res.type('png');
res.end(canvas.toBuffer(), 'binary');
});
@ -59,6 +61,7 @@ app.get('/:width/:seed', function(req, res) {
var width = parseInt(req.params.width) || 400;
var seed = sanitize(req.params.seed) || uuid();
var canvas = composeImage(width, width, seed);
res.type('png');
res.end(canvas.toBuffer(), 'binary');
});