Skip to content

Commit

Permalink
Add Content-Type headers to call faas client (#196)
Browse files Browse the repository at this point in the history
* Add Content-Type headers

* Update package version

* Fix unit tests
  • Loading branch information
levisingularity authored Mar 21, 2024
1 parent 9d981a3 commit 12c071f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions hyperon_das/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def _send_request(self, payload) -> Any:
method='POST',
url=self.url,
data=payload_serialized,
headers={'Content-Type': 'application/octet-stream'},
)

response.raise_for_status()
Expand Down
1 change: 1 addition & 0 deletions hyperon_das/query_engines.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ def _is_server_connect(self, url: str) -> bool:
method='POST',
url=url,
data=serialize({"action": "ping", "input": {}}),
headers={'Content-Type': 'application/octet-stream'},
timeout=10,
)
except Exception:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "hyperon-das"
version = "0.5.3"
version = "0.5.5"
description = "Query Engine API for Distributed AtomSpace"
authors = ["marcocapozzoli <[email protected]>"]
readme = "README.md"
Expand Down
7 changes: 7 additions & 0 deletions tests/unit/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def test_get_atom_success(self, mock_request):
method='POST',
url='http://example.com',
data=serialize(expected_request_data),
headers={'Content-Type': 'application/octet-stream'},
)

assert result == expected_response
Expand All @@ -60,6 +61,7 @@ def test_get_node_success(self, mock_request):
method='POST',
url='http://example.com',
data=serialize(expected_request_data),
headers={'Content-Type': 'application/octet-stream'},
)

assert result == expected_response
Expand Down Expand Up @@ -102,6 +104,7 @@ def test_get_link_success(self, mock_request):
method='POST',
url='http://example.com',
data=serialize(expected_request_data),
headers={'Content-Type': 'application/octet-stream'},
)

assert result == expected_response
Expand Down Expand Up @@ -140,6 +143,7 @@ def test_get_links_success(self, mock_request):
method='POST',
url='http://example.com',
data=serialize(expected_request_data),
headers={'Content-Type': 'application/octet-stream'},
)

assert result == expected_response
Expand Down Expand Up @@ -198,6 +202,7 @@ def test_query_success(self, mock_request):
method='POST',
url='http://example.com',
data=serialize(expected_request_data),
headers={'Content-Type': 'application/octet-stream'},
)

assert result == expected_response
Expand All @@ -216,6 +221,7 @@ def test_count_atoms_success(self, mock_request):
method='POST',
url='http://example.com',
data=serialize(expected_request_data),
headers={'Content-Type': 'application/octet-stream'},
)

assert result == expected_response
Expand All @@ -239,6 +245,7 @@ def test_send_request_success(self, mock_request):
method='POST',
url='http://example.com',
data=serialize(payload),
headers={'Content-Type': 'application/octet-stream'},
)

assert result == expected_response
Expand Down

0 comments on commit 12c071f

Please sign in to comment.