async def webhook_event(request: Request, resp: Response): oapi_request = OapiRequest(uri=request.url.path, body=await request.body(), header=OapiHeader(request.headers)) oapi_resp = handle_event(conf, oapi_request) resp.headers['Content-Type'] = oapi_resp.content_type resp.body = oapi_resp.body resp.status_code = oapi_resp.status_code return resp
def post(self, request): # type: (HttpRequest) -> HttpResponse oapi_request = OapiRequest(uri=request.path, body=request.body, header=OapiHeader(request.headers)) oapi_resp = handle_event(conf, oapi_request) resp = HttpResponse(oapi_resp.body, status=oapi_resp.status_code, content_type=oapi_resp.content_type) return resp
def webhook_event(): oapi_request = OapiRequest(uri=request.path, body=request.data, header=OapiHeader(request.headers)) resp = make_response() oapi_resp = handle_event(conf, oapi_request) resp.headers['Content-Type'] = oapi_resp.content_type resp.data = oapi_resp.body resp.status_code = oapi_resp.status_code return resp