Skip to content

Commit 1d57a3d

Browse files
author
Ioannis Kakavas
committed
Fix handling of Content-Type header
Content-Type header value can potentially contain charset and boundary values apart from media-type. Allow for gracefully handling these cases while differentiating between json and x-www-form-urlencoded
1 parent fbf3ea5 commit 1d57a3d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/satosa/proxy_server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ def unpack_post(environ, content_length):
3535
"""
3636
post_body = environ['wsgi.input'].read(content_length).decode("utf-8")
3737
data = None
38-
if environ["CONTENT_TYPE"] == "application/x-www-form-urlencoded":
38+
if "application/x-www-form-urlencoded" in environ["CONTENT_TYPE"]:
3939
data = dict(parse_qsl(post_body))
40-
elif environ["CONTENT_TYPE"] == "application/json":
40+
elif "application/json" in environ["CONTENT_TYPE"]:
4141
data = json.loads(post_body)
4242

4343
logger.debug("unpack_post:: %s", data)

0 commit comments

Comments
 (0)