Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

/join API endpoint returns incorrect Content-Type #562

Open
jlaine opened this issue Jun 21, 2018 · 4 comments
Open

/join API endpoint returns incorrect Content-Type #562

jlaine opened this issue Jun 21, 2018 · 4 comments

Comments

@jlaine
Copy link

jlaine commented Jun 21, 2018

Browsers and versions affected

All browsers.

Description

The POST to /join/ returns a JSON message, but the response headers indicate it is an HTML document.

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

@ArnaudFickinger
Copy link

hi, same problem, have you solved it?

@jlaine
Copy link
Author

jlaine commented Jun 27, 2018

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

@tobiasfriden
Copy link

@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.

@jlaine
Copy link
Author

jlaine commented Nov 21, 2018

@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!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants