This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require('supertest'); | |
var express = require('express'); | |
var app = express(); | |
app.get('/something', function (req, res) { res.send(200); }); | |
it('should respond with 200', function (done) { | |
// PRODUCES DOUBLE CALLBACK | |
request(app) | |
.get('/something') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
var data = JSON.parse(b); | |
} catch (e) {} | |
if (data.type === 'SOMEERROR') { | |
res.cookie(...) | |
return res.redirect(...) | |
} | |
return next('api:error...') |