Skip to content

Commit

Permalink
πŸ› json safe requests
Browse files Browse the repository at this point in the history
  • Loading branch information
juftin committed Dec 16, 2023
1 parent 53fffc2 commit f910372
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lunchable/models/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,14 @@ def lunchable_request(
Any
"""
url = APIConfig.make_url(url_path=url_path)
if payload is not None:
payload = pydantic_core.to_json(payload)
json_safe_payload = pydantic_core.to_jsonable_python(payload)
json_safe_params = pydantic_core.to_jsonable_python(params)
response = self.request(
method=method, url=url, params=params, content=payload, **kwargs
method=method,
url=url,
params=json_safe_params,
data=json_safe_payload,
**kwargs,
)
data = self.process_response(response=response)
return data

0 comments on commit f910372

Please sign in to comment.