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

Commit f2766d4

Browse files
committed
Response might not be a Message instance.
1 parent 87d5c67 commit f2766d4

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/oidcop/endpoint.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import json
12
import logging
23
from typing import Callable
34
from typing import Optional
@@ -363,7 +364,10 @@ def do_response(
363364
if self.response_placement == "body":
364365
if self.response_format == "json":
365366
content_type = "application/json; charset=utf-8"
366-
resp = _response.to_json()
367+
if isinstance(_response, Message):
368+
resp = _response.to_json()
369+
else:
370+
resp = json.dumps(_response)
367371
elif self.response_format in ["jws", "jwe", "jose"]:
368372
content_type = "application/jose; charset=utf-8"
369373
resp = _response

0 commit comments

Comments
 (0)