Skip to content
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
7 changes: 0 additions & 7 deletions renovate.json

This file was deleted.

10 changes: 8 additions & 2 deletions src/framex/plugin/on.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ def decorator(cls: type) -> type:
if getattr(func, "_on_request", False):
call_type = func.__expose__call_type
path = func.__expose_path__
api_prefix = func.__api_prefix

if not path:
call_type = ApiType.FUNC
elif not path.startswith(API_STR):
elif api_prefix and not path.startswith(API_STR):
path = f"{API_STR}{path}" if path.startswith("/") else f"{API_STR}/{path}"

params = extract_method_params(func)
Expand Down Expand Up @@ -64,7 +65,11 @@ def decorator(cls: type) -> type:


def on_request(
path: str | None = None, methods: list[str] | None = None, call_type: ApiType = ApiType.HTTP, stream: bool = False
path: str | None = None,
methods: list[str] | None = None,
call_type: ApiType = ApiType.HTTP,
stream: bool = False,
api_prefix: bool = True,
) -> Callable:
if methods is None:
methods = ["GET"]
Expand Down Expand Up @@ -96,6 +101,7 @@ def wrapper(func: Callable) -> Callable:
func.__expose_methods_ = methods # type: ignore [attr-defined]
func.__expose__call_type = call_type # type: ignore [attr-defined]
func.__expose_stream = stream # type: ignore [attr-defined]
func.__api_prefix = api_prefix # type: ignore [attr-defined]
return func

return wrapper
Expand Down
Loading