Skip to content

Commit

Permalink
Merge pull request #87 from mjpieters/use_httpx_for_json
Browse files Browse the repository at this point in the history
Leave JSON encoding to HTTPX
  • Loading branch information
volodymyrZotov authored Jan 5, 2024
2 parents bf1c6fa + dc5e390 commit a741a44
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/onepasswordconnectsdk/async_client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Python AsyncClient for connecting to 1Password Connect"""
import httpx
from httpx import HTTPError
import json
from typing import Dict, List, Union
import os

Expand Down Expand Up @@ -361,8 +360,8 @@ def build_request(self, method: str, path: str, body=None) -> httpx.Response:
"""

if body:
serialized_body = json.dumps(self.serializer.sanitize_for_serialization(body))
response = self.session.request(method, path, data=serialized_body)
sanitized_body = self.serializer.sanitize_for_serialization(body)
response = self.session.request(method, path, json=sanitized_body)
else:
response = self.session.request(method, path)
return response
Expand Down
4 changes: 2 additions & 2 deletions src/onepasswordconnectsdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,8 @@ def build_request(self, method: str, path: str, body=None) -> httpx.Response:
"""

if body:
serialized_body = json.dumps(self.serializer.sanitize_for_serialization(body))
response = self.session.request(method, path, data=serialized_body)
sanitized_body = self.serializer.sanitize_for_serialization(body)
response = self.session.request(method, path, json=sanitized_body)
else:
response = self.session.request(method, path)
return response
Expand Down

0 comments on commit a741a44

Please sign in to comment.