Skip to content
Closed
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
4 changes: 2 additions & 2 deletions fasthtml/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,8 @@ def __init__(self, f, skip=None): self.f,self.skip = f,skip or []
def __repr__(self): return f'Beforeware({self.f}, skip={self.skip})'

# %% ../nbs/api/00_core.ipynb #78c3c357
async def _handle(f, *args, **kwargs):
return (await f(*args, **kwargs)) if is_async_callable(f) else await run_in_threadpool(f, *args, **kwargs)
async def _handle(_f, *args, **kwargs):
return (await _f(*args, **kwargs)) if is_async_callable(_f) else await run_in_threadpool(_f, *args, **kwargs)

# %% ../nbs/api/00_core.ipynb #ad0f0e87
async def _wrap_ws(ws, data, params):
Expand Down
6 changes: 3 additions & 3 deletions nbs/api/00_core.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1132,8 +1132,8 @@
"outputs": [],
"source": [
"#| export\n",
"async def _handle(f, *args, **kwargs):\n",
" return (await f(*args, **kwargs)) if is_async_callable(f) else await run_in_threadpool(f, *args, **kwargs)"
"async def _handle(_f, *args, **kwargs):\n",
" return (await _f(*args, **kwargs)) if is_async_callable(_f) else await run_in_threadpool(_f, *args, **kwargs)"
]
},
{
Expand Down Expand Up @@ -4865,4 +4865,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
16 changes: 16 additions & 0 deletions tests/test_core.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from fasthtml.common import *
from starlette.testclient import TestClient

app, rt = fast_app()
cli = TestClient(app)

@rt("/test-f")
def post(f: str):
return Titled("Success", P(f"Value: {f}"))

def test_argument_f_collision():
res = cli.post('/test-f', data={'f': 'hello'})
assert res.status_code == 200
assert 'Value: hello' in res.text

test_argument_f_collision()