最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

[已解决]访问flask的Web服务器出错:message The browser or proxy sent a request that this server could not understand

WebServer crifan 14552浏览 0评论

flask出错。

 

搜:

flask “message”: “The browser (or proxy) sent a request that this server could not understand.”
This error message: “The browser (or proxy) sent a request that this server could not understand” happens if you speak https to a http server or http to a https server. Check your configuration of the websever. I guess you a running http on port 443.
on_json_loading_failed(e)
Called if decoding of the JSON data failed. The return value of this method is used by json when an error ocurred. The default implementation raises a JSONBadRequest, which is a subclass of BadRequest which sets the Content-Type to application/json and provides a JSON-formatted error description:
{“description”: “The browser (or proxy) sent a request that                              this server could not understand.”}
Changed in version 0.9: Return a JSONBadRequest instead of a BadRequest by default.
New in version 0.8.
class BadRequest(HTTPException):
    “””*400* `Bad Request`
    Raise if the browser sends something to the application the application
    or server cannot handle.
    “””
    code = 400
    description = (
        ‘The browser (or proxy) sent a request that this server could ‘
        ‘not understand.’
    )
->
最后证明:
是此处的Json数据有问题:
之前为了测试,把key的字符串从双引号改为单引号了
-》改回正常的双引号,即可。

转载请注明:在路上 » [已解决]访问flask的Web服务器出错:message The browser or proxy sent a request that this server could not understand

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 0.163 seconds, using 22.07MB memory