def accepts(self,
request: aiohttp.web.Request) -> Set[str]:
''' Return a sequence of accepts items in the request headers '''
accepts = set() # type: Set[str]
accept_headers = request.headers.getall(ACCEPT)
logger.debug('accept: {}'.format(accept_headers))
for accept_items in accept_headers:
if ';' in accept_items:
accept_items = [i.strip() for i in accept_items.split(';')]
else:
accept_items = [accept_items]
accepts.update(accept_items)
return accepts
评论列表
文章目录