Tag: 超最佳值

如何使用superagent / supertest链接http调用?

我正在用超级testing一个快速API。 在testing用例中,我无法获得多个请求来处理超级用户。 以下是我在testing用例中尝试的内容。 但是testing用例似乎只执行最后一次调用,即HTTP GET。 it('should respond to GET with added items', function(done) { var agent = request(app); agent.post('/player').type('json').send({name:"Messi"}); agent.post('/player').type('json').send({name:"Maradona"}); agent.get('/player').set("Accept", "application/json") .expect(200) .end(function(err, res) { res.body.should.have.property('items').with.lengthOf(2); done(); }); ); 我在这里失踪的任何东西,还是有另一种方法链接与superagent http调用?