Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable HEAD request instead of ony GET #269

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions xpublish/plugins/included/zarr.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def dataset_router(self, deps: Dependencies) -> APIRouter: # noqa: D102
tags=list(self.dataset_router_tags),
)

@router.get(f'/{ZARR_METADATA_KEY}')
@router.api_route(f'/{ZARR_METADATA_KEY}',methods=['GET', 'HEAD'])
def get_zarr_metadata(
dataset=Depends(deps.dataset),
cache=Depends(deps.cache),
Expand All @@ -52,7 +52,7 @@ def get_zarr_metadata(

return JSONResponse(zjson)

@router.get(f'/{group_meta_key}')
@router.api_route(f'/{group_meta_key}',methods=['GET', 'HEAD'])
def get_zarr_group(
dataset=Depends(deps.dataset),
cache=Depends(deps.cache),
Expand All @@ -63,7 +63,7 @@ def get_zarr_group(

return JSONResponse(zmetadata['metadata'][group_meta_key])

@router.get(f'/{attrs_key}')
@router.api_route(f'/{attrs_key}',methods=['GET', 'HEAD'])
def get_zarr_attrs(
dataset=Depends(deps.dataset),
cache=Depends(deps.cache),
Expand All @@ -74,7 +74,7 @@ def get_zarr_attrs(

return JSONResponse(zmetadata['metadata'][attrs_key])

@router.get('/{var}/{chunk}')
@router.api_route('/{var}/{chunk}',methods=['GET', 'HEAD'])
def get_variable_chunk(
var: str = Path(description='Variable in dataset'),
chunk: str = Path(description='Zarr chunk'),
Expand Down