Skip to content

Commit 05f593d

Browse files
jhrozekblkt
authored andcommitted
Dump raw JSON messages (#1080)
This amends the helper that dumps the requests to dump the JSON as represented by the models instead of a printable representation of the models.
1 parent c4386d6 commit 05f593d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/codegate/providers/base.py

+4
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,10 @@ def _dump_request_response(self, prefix: str, data: Any) -> None:
246246

247247
with open(fname, "w") as f:
248248
json.dump(data, f, indent=2)
249+
elif hasattr(data, "json"):
250+
# The new format
251+
with open(fname, "w") as f:
252+
f.write(data.json())
249253
else:
250254
with open(fname, "w") as f:
251255
f.write(str(data))

0 commit comments

Comments
 (0)