-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support and tests for legacy mosaic tile routes
The tile route prefixes were reordered in recent versions of titiler.pgstac. Both versions of the routes are supported in PC and tests have been added to confirm.
- Loading branch information
1 parent
66fa8fe
commit 89a9570
Showing
8 changed files
with
252 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import logging | ||
from typing import Callable | ||
|
||
import fastapi | ||
import starlette | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def get_endpoint_function( | ||
router: fastapi.APIRouter, path: str, method: str | ||
) -> Callable: | ||
for route in router.routes: | ||
match, _ = route.matches({"type": "http", "path": path, "method": method}) | ||
if match == starlette.routing.Match.FULL: | ||
# The abstract BaseRoute doesn't have a `.endpoint` attribute, | ||
# but all of its subclasses do. | ||
return route.endpoint # type: ignore [attr-defined] | ||
|
||
logger.warning(f"Could not find endpoint. method={method} path={path}") | ||
raise fastapi.HTTPException(detail="Internal system error", status_code=500) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters