Open pjincz opened 9 years ago
That code is meant to prevent rendering the toolbar multiple times, and only when the request is expecting HTML and is not ajax -- what error are you getting, can you provide a test case?
Hi friend, Thank you for your reply. Here is a demo to reproduce:
// app.js
var express = require('express');
var app = express();
app.get('/', function(req, res) {
console.log(req.headers.accept);
res.render('index.jade', function (err, data){
res.send(data.replace('kitty', 'world'));
});
});
require('express-debug')(app);
app.listen(3000);
// views/index.jade
h1 hello kitty
// dependency: express, jade, express-debug
Then, in access http://127.0.0.1:3000
, got hello world
, it's OK.
Try
$ curl 127.0.0.1:3000
<h1>hello kitty</h1>
# wrong result, result sent around callback
I have reviewed the code, line 91-94 is not necessary at all, and it break res.render callback.