Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix modifier param name #826

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lyrebird/checker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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

Expand Down
6 changes: 3 additions & 3 deletions lyrebird/checker/on_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions lyrebird/checker/on_request_upstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lyrebird/plugins/plugin_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,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
Expand All @@ -112,7 +112,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
Expand Down
Loading