Skip to content

Commit 3c1fded

Browse files
committed
Support for more HTTP header types.
1 parent b8cabea commit 3c1fded

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/idpyoidc/client/util.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
from urllib.parse import urlsplit
88
from urllib.parse import urlunsplit
99

10+
from cryptojwt.jws.jws import factory
11+
1012
from idpyoidc.constant import DEFAULT_POST_CONTENT_TYPE
1113
from idpyoidc.constant import JOSE_ENCODED
1214
from idpyoidc.constant import JSON_ENCODED
@@ -264,7 +266,11 @@ def get_deserialization_method(reqresp):
264266
reqresp.json()
265267
return "json"
266268
except Exception:
267-
return "urlencoded" # reasonable default ??
269+
try:
270+
_jwt = factory(reqresp.txt)
271+
return "jwt"
272+
except Exception:
273+
return "urlencoded" # reasonable default ??
268274

269275
if match_to_("application/json", _ctype) or match_to_("application/jrd+json", _ctype):
270276
deser_method = "json"
@@ -276,6 +282,8 @@ def get_deserialization_method(reqresp):
276282
deser_method = "urlencoded"
277283
elif match_to_("text/plain", _ctype) or match_to_("test/html", _ctype):
278284
deser_method = ""
285+
elif _ctype.startswith("application/") and _ctype.endswith("+jwt"):
286+
deser_method = "jwt"
279287
else:
280288
deser_method = "" # reasonable default ??
281289

0 commit comments

Comments
 (0)