From 5500797d34ac4315a847490b00ece08c4ec383d6 Mon Sep 17 00:00:00 2001 From: Axel Bocciarelli Date: Thu, 7 Mar 2024 16:23:02 +0100 Subject: [PATCH] Allow `bin` enconding for non-numeric content --- h5grove/encoders.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/h5grove/encoders.py b/h5grove/encoders.py index f054e99..37ba4d5 100644 --- a/h5grove/encoders.py +++ b/h5grove/encoders.py @@ -111,10 +111,6 @@ def encode(content: Any, encoding: Optional[str] = "json") -> Response: ) content_array = np.array(content, copy=False) - if not is_numeric_data(content_array): - raise QueryArgumentError( - f"Unsupported encoding {encoding} for non-numeric content" - ) if encoding == "bin": return Response( @@ -123,6 +119,11 @@ def encode(content: Any, encoding: Optional[str] = "json") -> Response: "Content-Type": "application/octet-stream", }, ) + + if not is_numeric_data(content_array): + raise QueryArgumentError( + f"Unsupported encoding {encoding} for non-numeric content" + ) if encoding == "csv": return Response(