Skip to content

Commit 1deb016

Browse files
committed
fix content-type matching
1 parent b8424f9 commit 1deb016

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/stac_auth_proxy/middleware/AuthenticationExtensionMiddleware.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class AuthenticationExtensionMiddleware(JsonResponseMiddleware):
3434
"https://stac-extensions.github.io/authentication/v1.1.0/schema.json"
3535
)
3636

37-
json_content_type_expr: str = r"(application/json|geo\+json)"
37+
json_content_type_expr: str = r"application/(geo\+)?json"
3838

3939
state_key: str = "oidc_metadata"
4040

@@ -82,7 +82,7 @@ def transform_json(self, data: dict[str, Any], request: Request) -> dict[str, An
8282
schemes = scheme_loc.setdefault("auth:schemes", {})
8383
schemes[self.auth_scheme_name] = {
8484
"type": "oauth2",
85-
"description": "requires an authentication token",
85+
"description": "requires an authentication bearertoken",
8686
"flows": {
8787
"authorizationCode": {
8888
"authorizationUrl": oidc_metadata["authorization_endpoint"],

tests/test_auth_extension.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ def request_scope():
3434
}
3535

3636

37-
@pytest.fixture
38-
def json_headers():
37+
@pytest.fixture(params=["application/json", "application/geo+json"])
38+
def json_headers(request):
3939
"""Create headers with JSON content type."""
40-
return Headers({"content-type": "application/json"})
40+
return Headers({"content-type": request.param})
4141

4242

4343
@pytest.fixture

0 commit comments

Comments
 (0)