Skip to content

Commit

Permalink
feat: add hook process_request_hook (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
e-lobo authored Oct 29, 2022
1 parent 8b907d4 commit 28375c3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions frappe/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ def process_response(response):
if hasattr(frappe.local, 'conf') and frappe.conf.allow_cors:
set_cors_headers(response)

run_process_request_hook(response)

def set_cors_headers(response):
origin = frappe.request.headers.get('Origin')
allow_cors = frappe.conf.allow_cors
Expand Down Expand Up @@ -292,6 +294,11 @@ def after_request(rollback):

return rollback


def run_process_request_hook(response):
for process_request in frappe.get_hooks('process_request_hook', []):
frappe.get_attr(process_request)(response)

application = local_manager.make_middleware(application)

def serve(port=8000, profile=False, no_reload=False, no_threading=False, site=None, sites_path='.'):
Expand Down

0 comments on commit 28375c3

Please sign in to comment.