apprtc
apprtc copied to clipboard
/join API endpoint returns incorrect Content-Type
Browsers and versions affected
All browsers.
Description
The POST to /join/
Steps to reproduce
Open the browser's network inspector and join any room.
Expected results
The HTTP headers should contain:
Content-Type: application/json
Actual results
The HTTP headers contain:
Content-Type: text/html; charset=utf-8
hi, same problem, have you solved it?
For my usecase, I ended up having to "manually" decode the JSON payload, since the invalid Content-Type prevents me from using aiohttp's .json() method:
https://github.com/jlaine/aiortc/blob/a402b8c51de66a28d004e072e77308d543a29fcd/examples/apprtc/apprtc.py#L98
@jlaine Possible workaround from https://stackoverflow.com/questions/48840378/python-attempt-to-decode-json-with-unexpected-mimetype:
Use response.json(content_type=None) to disable warning.
@tobiasfriden Thanks for the pointer, but I'm not really looking for another workaround - my current one works. What I'd like is for the webservice to return the correct Content-Type so that no workaround is needed!