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

Support POST for /node/full/ #587

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions tiled/client/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,10 @@ def __getitem__(self, keys, _ignore_inlined_contents=False):
key, *tail = keys
tail = tuple(tail) # list -> tuple
content = handle_error(
self.context.http_client.get(
self.context.http_client.post(
self.item["links"]["search"],
headers={"Accept": MSGPACK_MIME_TYPE},
params={
json={
**_queries_to_params(KeyLookup(key)),
**self._queries_as_params,
**self._sorting_params,
Expand Down
57 changes: 55 additions & 2 deletions tiled/server/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from functools import partial
from typing import Any, List, Optional

from fastapi import APIRouter, Depends, HTTPException, Query, Request, Security
from fastapi import APIRouter, Body, Depends, HTTPException, Query, Request, Security
from jmespath.exceptions import JMESPathError
from pydantic import BaseSettings

Expand Down Expand Up @@ -545,7 +545,7 @@ async def table_partition(
response_model=schemas.Response,
name="full 'container' or 'table'",
)
async def node_full(
async def get_node_full(
request: Request,
entry=SecureEntry(scopes=["read:data"]),
principal: str = Depends(get_current_principal),
Expand All @@ -554,6 +554,59 @@ async def node_full(
filename: Optional[str] = None,
serialization_registry=Depends(get_serialization_registry),
settings: BaseSettings = Depends(get_settings),
):
"""
Fetch the data below the given node.
"""
return await _node_full(
request=request,
entry=entry,
principal=principal,
field=field,
format=format,
filename=filename,
serialization_registry=serialization_registry,
settings=settings,
)

@router.post(
"/node/full/{path:path}",
response_model=schemas.Response,
name="full 'container' or 'table'",
)
async def post_node_full(
request: Request,
body: Optional[List[str]] = Body(None, min_length=1),
entry=SecureEntry(scopes=["read:data"]),
principal: str = Depends(get_current_principal),
format: Optional[str] = None,
filename: Optional[str] = None,
serialization_registry=Depends(get_serialization_registry),
settings: BaseSettings = Depends(get_settings),
):
"""
Fetch the data below the given node.
"""
return await _node_full(
request=request,
entry=entry,
principal=principal,
field=body,
format=format,
filename=filename,
serialization_registry=serialization_registry,
settings=settings,
)

async def _node_full(
request: Request,
entry,
principal: str,
field: Optional[List[str]],
format: Optional[str],
filename: Optional[str],
serialization_registry,
settings: BaseSettings,
):
"""
Fetch the data below the given node.
Expand Down
Loading