Skip to content
This repository was archived by the owner on Jan 5, 2026. It is now read-only.

Conversation

@mdrichardson
Copy link
Contributor

Fixes: https://github.com/microsoft/botbuilder-python/issues/312

Issue Summary

request.headers["Content-Type"] sometimes comes in as

application/json; charset=utf-8

...which causes the 415: UnsupportedMediaType to throw.

Changes

In app.py for the samples, it implements this diff:

@app.route("/api/messages", methods=["POST"])
def messages():
    """Main bot message handler."""
-   if request.headers["Content-Type"] == "application/json":
+   if "application/json" in request.headers["Content-Type"]:
        body = request.json
    else:
        return Response(status=415)

@mdrichardson
Copy link
Contributor Author

...working on pylint fixes, although the errors don't appear to be related to this PR

@axelsrz
Copy link
Member

axelsrz commented Sep 27, 2019

No, those issues are not related with this PR. I will fix it today and merge this.

@mdrichardson
Copy link
Contributor Author

@axelsrz No further input needed from me, then?

@axelsrz
Copy link
Member

axelsrz commented Sep 27, 2019

@mdrichardson no

@axelsrz axelsrz merged commit bb0b7ef into microsoft:master Sep 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UnsupportedMediaType - Azure Linux WebApp

2 participants