在自动化测试期间用于 API 模拟的简单 http 服务器
项目描述
在自动化测试期间用于 API 模拟的简单 http 服务器
示例用法
使用请求库:
>>> import requests
>>> from httpsrv import Server
>>> server = Server(8080).start()
>>> server.on('GET', '/').text('hello')
>>> res = requests.get('http://localhost:8080')
>>> assert res.text == 'hello'
安装
pip install httpsrv