如果我想向烧瓶应用程序发送请求,我该怎么做:
test_client = Flask(__name__).test_client()
test_client.post('/media', data={'file': (open('file.jpg'), 'file.jpg')})
这有效,但是当我尝试向data
添加其他参数时,请求发送的不仅仅是文件我收到了错误。
如何传递除文件以外的参数?
当我发送类似的东西时:
test_client.post('/media', data={'file': (open('file.jpg'), 'file.jpg'), 'abc': '123'})
当我在我的终端上打印request.json
时,我会回来None
。