Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var APIeasy = require('api-easy'),
- assert = require('assert');
- var suite = APIeasy.describe('/api');
- var urlRedir;
- suite.discuss('Test Redirection API')
- .use('localhost', 3000)
- .setHeader('Content-Type', 'application/json')
- .followRedirect(false)
- .path('/login')
- .post({user: {email:'tmp@gmail.com', password:'tmp'}})
- .expect(302)
- .expect('redirect content', function (err, res, body) {
- urlRedir = res.headers.location;
- })
- .next()
- .get(urlRedir) //the urlRedir is null, the real url is /login and this is from path()
- .expect(200)
- .expect('get redir url content', function(err, res, body){
- console.log(body);
- })
- .export(module);
Add Comment
Please, Sign In to add comment