diff --git a/lyrebird/checker/__init__.py b/lyrebird/checker/__init__.py index adda6a7c..a8542560 100644 --- a/lyrebird/checker/__init__.py +++ b/lyrebird/checker/__init__.py @@ -328,7 +328,7 @@ def json(self): class DecoratorUtils: @staticmethod - def modifiy_request_body_decorator(func, modifiy_request_body): + def modify_request_body_decorator(func, modify_request_body): # When the request modifier modifies only headers or urls, # ensure that the Origin request body switch is still in effect after the request modifier is triggered @functools.wraps(func) @@ -337,9 +337,9 @@ def wrapper(*args, **kwargs): if isinstance(args, (list, tuple)) and len(args) > 0 and isinstance(args[0], dict): if 'keep_origin_request_body' in args[0]: # When multiple request modifiers are triggered, the original request data is not used as long as one modifies the requestBody - args[0]['keep_origin_request_body'] = args[0]['keep_origin_request_body'] and not modifiy_request_body + args[0]['keep_origin_request_body'] = args[0]['keep_origin_request_body'] and not modify_request_body else: - args[0]['keep_origin_request_body'] = not modifiy_request_body + args[0]['keep_origin_request_body'] = not modify_request_body return result return wrapper diff --git a/lyrebird/checker/on_request.py b/lyrebird/checker/on_request.py index 3a71d9d4..5c35adcf 100644 --- a/lyrebird/checker/on_request.py +++ b/lyrebird/checker/on_request.py @@ -4,7 +4,7 @@ class OnRequestHandler: - def __call__(self, rules=None, rank=0, modifiy_request_body=True, *args, **kw): + def __call__(self, rules=None, rank=0, modify_request_body=True, *args, **kw): def func(origin_func): func_type = checker.TYPE_ON_REQUEST if not checker.scripts_tmp_storage.get(func_type): @@ -14,14 +14,14 @@ def func(origin_func): 'func': origin_func, 'rules': rules, 'rank': rank if isinstance(rank, (int, float)) else 0, - 'modifiy_request_body': modifiy_request_body + 'modify_request_body': modify_request_body }) return origin_func return func @staticmethod def register(func_info): - func_info['func'] = checker.DecoratorUtils.modifiy_request_body_decorator(func_info['func'], func_info['modifiy_request_body']) + func_info['func'] = checker.DecoratorUtils.modify_request_body_decorator(func_info['func'], func_info['modify_request_body']) application.on_request.append(func_info) @staticmethod diff --git a/lyrebird/checker/on_request_upstream.py b/lyrebird/checker/on_request_upstream.py index 2cef2f5f..6e89dfdd 100644 --- a/lyrebird/checker/on_request_upstream.py +++ b/lyrebird/checker/on_request_upstream.py @@ -4,7 +4,7 @@ class OnRequestUpstreamHandler: - def __call__(self, rules=None, rank=0, modifiy_request_body=True, *args, **kw): + def __call__(self, rules=None, rank=0, modify_request_body=True, *args, **kw): def func(origin_func): func_type = checker.TYPE_ON_REQUEST_UPSTREAM if not checker.scripts_tmp_storage.get(func_type): @@ -14,14 +14,14 @@ def func(origin_func): 'func': origin_func, 'rules': rules, 'rank': rank if isinstance(rank, (int, float)) else 0, - 'modifiy_request_body': modifiy_request_body + 'modify_request_body': modify_request_body }) return origin_func return func @staticmethod def register(func_info): - func_info['func'] = checker.DecoratorUtils.modifiy_request_body_decorator(func_info['func'], func_info['modifiy_request_body']) + func_info['func'] = checker.DecoratorUtils.modify_request_body_decorator(func_info['func'], func_info['modify_request_body']) application.on_request_upstream.append(func_info) @staticmethod diff --git a/lyrebird/plugins/plugin_manager.py b/lyrebird/plugins/plugin_manager.py index 52962ca3..27d0c671 100644 --- a/lyrebird/plugins/plugin_manager.py +++ b/lyrebird/plugins/plugin_manager.py @@ -95,7 +95,7 @@ def print_plugin_api(response): 'func': handler[1], 'rules': handler[2] if len(handler) > 2 else None, 'rank': handler[3] if len(handler) > 3 and isinstance(handler[3], (int, float)) else 0, - 'modifiy_request_body': handler[4] if len(handler) > 4 else True + 'modify_request_body': handler[4] if len(handler) > 4 else True }) # Subscribe handler on response @@ -114,7 +114,7 @@ def print_plugin_api(response): 'func': handler[1], 'rules': handler[2] if len(handler) > 2 else None, 'rank': handler[3] if len(handler) > 3 and isinstance(handler[3], (int, float)) else 0, - 'modifiy_request_body': handler[4] if len(handler) > 4 else True + 'modify_request_body': handler[4] if len(handler) > 4 else True }) # Subscribe handler on proxy response