node.js:Mock http请求和响应 [英] node.js: Mock http request and response

查看:289
本文介绍了node.js:Mock http请求和响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

解决方案

看起来像是两个< a href =https://github.com/howardabrams/node-mocks-http> https://github.com/howardabrams/node-mocks-http 和 https://github.com/vojtajina/node-mocks 可用于创建模拟 http.ServerRequest http.ServerResponse 对象。


Is there convenient way to mock the HTTP Request and Response objects for unit testing middlewares?

解决方案

It looks like both https://github.com/howardabrams/node-mocks-http and https://github.com/vojtajina/node-mocks can be used to create mock http.ServerRequest and http.ServerResponse objects.

这篇关于node.js:Mock http请求和响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆