困扰很多天的
def index(request):
return web.Response(body=b'<h1>Awesome</h1>')
打开网页永远是<h1>Awesome</h1>而不是Awesome
明明没动代码的。。虽然不是很懂,但是查了一下aiohttp的文档
Response类声明为class aiohttp.web.Response(*, status=200, headers=None, content_type=None, body=None, text=None)
也就是港有个content_type
又看到有个文章也提到了在chrome下打开网页永远是下载网页的问题,
他把content_type加上去等于text/html 也就是
def index(request):
return web.Response(body=b'<h1>Awesome</h1>', content_type='text/html')
奇迹粗线了 正常显示了 而且chrome打开也不下载了 nice啊