我正在使用 API-easy ,如何在 _id_user 中获得此结果并将调用发送到 .post() 谢谢。例如
var APIeasy = require('api-easy'),
assert = require('assert');
var _id_user;
var suite = APIeasy.describe('Test User');
suite.use('localhost', 3000)
.discuss('Test')
.setHeader('Content-Type', 'application/x-www-form-urlencoded')
.post('/user/authenticate', {data: '{"email":"emailuser@email.com","password":"123456"}')
.expect('should respond with ID user', function (err, res, body) {
_id_user = body; // I need this result to be sent in the next call .post()
}).next()
.post('/user/validate',{ data : _id_user}) // this result always comes null
.expect('should respond TRUE', function (_err, _res, _body) {
}).export(module);