Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixup: res.render(view, opts, callback), callback broken #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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