From 8bef0fb075158a7f3c4aa302766f8fcb3f6ddbaa Mon Sep 17 00:00:00 2001 From: Solomon Negusse Date: Thu, 14 Oct 2021 16:13:14 -0500 Subject: [PATCH] add more detailed docstring to redirect_alias_to_version middleware --- app/middleware.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/middleware.py b/app/middleware.py index d9b784d62..000b111b8 100644 --- a/app/middleware.py +++ b/app/middleware.py @@ -78,7 +78,14 @@ async def redirect_latest(request: Request, call_next): async def redirect_alias_to_version(request: Request, call_next): - """Redirect version request by alias to the actual dataset version.""" + """Redirect version request by alias to the actual dataset version. + + For GET requests matching /dataset/{dataset}/{version} OR POST + requests matching /dataset/{dataset}/{version}/download or + /dataset/{dataset}/{version}/query, this will check if {version} + matches an existing alias and redirect to the dataset version + associated with the alias. + """ path_items = request.url.path.split("/") is_dataset_version_path = len(path_items) >= 4 and path_items[1] == "dataset"