Skip to content

Conversation

@pjincz
Copy link

@pjincz pjincz commented Jul 3, 2015

I have reviewed the code, line 91-94 is not necessary at all, and it break res.render callback.

@devoidfury
Copy link
Owner

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?

@pjincz
Copy link
Author

pjincz commented Jul 6, 2015

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants