This commit is contained in:
yumoqing 2023-06-08 12:06:38 +08:00
parent 494a3eb8f8
commit 5156138571

View File

@ -79,10 +79,15 @@ class BaseProcessor(AppLogger):
await self.datahandle(request)
return self.content
def set_response_headers(self, response):
response.headers['Access-Control-Expose-Headers'] = 'AIOHTTP_SESSION'
response.headers['Access-Control-Allow-Credentials'] = 'true'
response.headers['Access-Control-Allow-Origin'] = '47.93.12.75'
async def handle(self,request):
await self.execute(request)
if self.retResponse is not None:
self.retResponse.headers['Access-Control-Expose-Headers'] = 'Set-Cookie'
self.set_response_headers(self.retResponse)
return self.retResponse
elif type(self.content) == type({}) :
self.content = json.dumps(self.content,
@ -93,7 +98,9 @@ class BaseProcessor(AppLogger):
self.headers['Content-Type'] = "application/json; utf-8"
self.headers['Access-Control-Expose-Headers'] = 'Set-Cookie'
return Response(text=self.content,headers=self.headers)
resp = Response(text=self.content,headers=self.headers)
self.set_response_headers(resp)
return resp
async def datahandle(self,request):
self.debug('*******Error*************')