Skip to content

Commit

Permalink
Fix browsersync middleware error.
Browse files Browse the repository at this point in the history
Fix Headers already sent problem
  • Loading branch information
danielfdsilva committed Jun 1, 2016
1 parent 4703bcd commit dc77010
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gulp-addons.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ module.exports.graphicsMiddleware = function (fs) {
if (pieces[1].match(/\.svgz?$/)) {
res.setHeader('Content-Type', 'image/svg+xml');
}
res.end(fs.readFileSync(path.join(__dirname, './assets/graphics', pieces[1])));
// Body gets modified. End response.
return res.end(fs.readFileSync(path.join(__dirname, './assets/graphics', pieces[1])));
} catch (e) {
// Nothing to do there.
return next();
}
return next();
};
};

0 comments on commit dc77010

Please sign in to comment.