Skip to content

Commit

Permalink
add more detailed docstring to redirect_alias_to_version middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
solomon-negusse committed Oct 14, 2021
1 parent 5dee1a0 commit 8bef0fb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 8bef0fb

Please sign in to comment.