Skip to content

Commit

Permalink
Cannot use bare slash "/" as root_path in a Fast-API app. (#255)
Browse files Browse the repository at this point in the history
* Cannot use bare slash "/" as root_path in a Fast-API app.

* Update initial request to /catalogs

---------

Co-authored-by: david <dcchabgood@gmail.com>
  • Loading branch information
ashleysommer and recalcitrantsupplant committed Aug 16, 2024
1 parent f9e4152 commit 29b0855
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions function_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@

# This is the base URL path that Prez routes will stem from
# must _start_ in a slash, but _not end_ in slash, eg: /prez
env_root_path: str = os.getenv("FUNCTION_APP_ROOT_PATH", "/")
env_root_path: str = os.getenv("FUNCTION_APP_ROOT_PATH", "")
ROOT_PATH: str = env_root_path.strip()
# Note, must be _empty_ string for no path prefix (not "/")
if ROOT_PATH == "/":
ROOT_PATH = ""
env_auth_level: str = os.getenv("FUNCTION_APP_AUTH_LEVEL", "FUNCTION")
env_auth_level = env_auth_level.strip().upper()
if env_auth_level == "ADMIN":
Expand All @@ -35,7 +38,7 @@
from azure.functions import HttpRequest, Context
import asyncio

req = HttpRequest("GET", "/v", headers={}, body=b"")
req = HttpRequest("GET", "/catalogs", headers={}, body=b"")
context = dict()
loop = asyncio.get_event_loop()

Expand Down

0 comments on commit 29b0855

Please sign in to comment.