为什么 Nock 给我一个错误说身体不匹配?
这是我的代码。
it('Should Delete /user/removeuserskills', function(done){
mockRequest
.delete('/user/removeuserskills',{skill:'accountant'})
.reply(201,{
'status':200,
'message': '200: Successfully deleted skill'
})
.log(console.log)
request
.delete('/user/removeuserskills',{skill:'accountant'})
.end(function(err, res){
if(err){
console.log(err);
}
else{
expect(res.body.status).to.equal(200);
expect(res.body.message).to.equal('200: Successfully deleted skill');}
done();
});
});
当我使用.log
我不知道为什么它告诉我身体不匹配。我特别明白这一点。
matching http://localhost:8080 to DELETE http://localhost:8080/user/removeuserskills: true
bodies don't match:
{ skill: 'accountant' }
{ Error: Nock: No match for request {
"method": "DELETE",
"url": "http://localhost:8080/user/removeuserskills"
}