Skip to content

Commit

Permalink
update octet-stream
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Rybakov committed Sep 2, 2024
1 parent c9412fa commit 7019211
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions deker_server_adapters/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,11 @@ def update(self, array: "BaseArray", bounds: Slice, data: Numeric) -> None:
"""
bounds = slice_converter[bounds]
url = f"{self.path_stripped}/{self.type.name}/by-id/{array.id}/subset/{bounds}/data"
request_kwargs = {"json": data}
if hasattr(data, "tolist"):
request_kwargs["json"] = data.tolist()
request_kwargs = {"headers": {"Content-Type": "application/octet-stream"}}
if hasattr(data, "tobytes"):
request_kwargs["data"] = data.tobytes()
else:
request_kwargs["data"] = bytes(data)
# We write (v)array through the node it belongs in cluster
try:
if self.client.cluster_mode:
Expand Down

0 comments on commit 7019211

Please sign in to comment.