Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Commit 4dc5566

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 e7bd630 commit 4dc5566

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/codegate/providers/base.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,10 @@ def _dump_request_response(self, prefix: str, data: Any) -> None:
228228

229229
with open(fname, "w") as f:
230230
json.dump(data, f, indent=2)
231+
elif hasattr(data, "json"):
232+
# The new format
233+
with open(fname, "w") as f:
234+
f.write(data.json())
231235
else:
232236
with open(fname, "w") as f:
233237
f.write(str(data))

0 commit comments

Comments
 (0)