示例#1
0
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
示例#2
0
 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
示例#3
0
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