Skip to content

Commit

Permalink
Merge pull request #88 from ecmwf-projects/cache-control
Browse files Browse the repository at this point in the history
Cache control
  • Loading branch information
keul authored Oct 11, 2024
2 parents 5a2e8e6 + 950c0bd commit 237e1ee
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cads_catalogue_api_service/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ async def lifespan(application: fastapi.FastAPI):
BrotliMiddleware,
PrometheusMiddleware,
stac_fastapi.api.middleware.CORSMiddleware,
# middlewares.CacheControlMiddleware,
middlewares.CacheControlMiddleware,
middlewares.LoggerInitializationMiddleware,
],
# FIXME: this must be different from site to site
Expand Down
4 changes: 3 additions & 1 deletion cads_catalogue_api_service/schema_org.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ def schema_org_json_ld(
distribution=[
(
models.schema_org.DataDownload(
encodingFormat=collection.get("file_format"),
encodingFormat=collection.get("file_format")
# Sometimes the file_format is not defined on the input data
or "application/octet-stream",
contentUrl=f"{url}?tab=download",
)
if distribution
Expand Down
2 changes: 1 addition & 1 deletion tests/test_40_schema_org.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def test_schema_org_jsonId(monkeypatch) -> None:
"distribution": [
{
"@type": "DataDownload",
"encodingFormat": "",
"encodingFormat": "application/octet-stream",
"contentUrl": "http://localhost:8080/api/catalogue/v1/collections/era5-something?tab=download",
}
],
Expand Down

0 comments on commit 237e1ee

Please sign in to comment.