Skip to content

Conversation

mcfog
Copy link

@mcfog mcfog commented Mar 9, 2014

I love the idea of Route Forwarding but somehow encounter a problem. I prefer pass result or error to browser with node style [err, result, ...] which is really common convention

    try {
        var data = doSomething();
        res.io.respond(null, data);
    } catch(err) {
        res.io.respond(err);
    }

but it doesnt work with Route-Forwarding because express's res.json expect additional param as status code, so res.io.respond(null, data) => res.json(null, data) just crash express.

writing sth. like res.io.respond(500, err) works with current express.io but really sounds strange, so I send this PR to change this behavior. it does break backward compatibility but I believe it worth that

…1, arg2, ...)` => `res.json([null, arg1, arg2, ...])`
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.

1 participant