Skip to content

Commit

Permalink
Merge pull request #28 from eodcgmbh/update-redirect
Browse files Browse the repository at this point in the history
update the redirect function
  • Loading branch information
SerRichard authored Nov 19, 2024
2 parents 03a3073 + 02bdca5 commit a5da4bb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
15 changes: 6 additions & 9 deletions openeo_argoworkflows/api/openeo_argoworkflows_api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from starlette.responses import RedirectResponse

from openeo_fastapi.api.app import OpenEOApi
from openeo_fastapi.api.models import WellKnownOpeneoGetResponse
from openeo_fastapi.api.types import Billing, Plan, FileFormat, GisDataType
from openeo_fastapi.client.core import OpenEOCore

Expand Down Expand Up @@ -84,29 +85,25 @@
"OpenEO-Identifier",
],
)


def redirect_wellknown():
return RedirectResponse("/.well-known/openeo")


api.app.router.add_api_route(
name="redirect_wellknown",
path=f"/{client.settings.OPENEO_VERSION}/.well-known/openeo",
response_model=None,
response_model=WellKnownOpeneoGetResponse,
response_model_exclude_unset=False,
response_model_exclude_none=True,
methods=["GET"],
endpoint=redirect_wellknown,
endpoint=client.get_well_known,
)

api.app.router.add_api_route(
name="redirect_wellknown",
path=f"/openeo/{client.settings.OPENEO_VERSION}/.well-known/openeo",
response_model=None,
response_model=WellKnownOpeneoGetResponse,
response_model_exclude_unset=False,
response_model_exclude_none=True,
methods=["GET"],
endpoint=redirect_wellknown,
endpoint=client.get_well_known,
)

app = api.app
2 changes: 1 addition & 1 deletion openeo_argoworkflows/api/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "openeo-argoworkflows-api"
version = "2024.11.2"
version = "2024.11.3"
description = ""
authors = ["sean <sean.hoyal@external.eodc.eu>"]
readme = "README.md"
Expand Down
7 changes: 7 additions & 0 deletions openeo_argoworkflows/api/tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,12 @@ def test_get_wellknown(mock_settings):

app = TestClient(app_api)

resp = app.get(test_path)
assert resp.status_code == 200

test_path = f"openeo/{mock_settings.OPENEO_VERSION}/.well-known/openeo"

app = TestClient(app_api)

resp = app.get(test_path)
assert resp.status_code == 200

0 comments on commit a5da4bb

Please sign in to comment.