awsgi icon indicating copy to clipboard operation
awsgi copied to clipboard

Request fail on parsing json body with accent character

Open oliviercperrier opened this issue 6 years ago • 1 comments

I am calling an endpoint i made to update a customer. When passing my json body i get a 400 Bad request. Seems like a json body that contains accent characters is not parsed correctly by the request object.

Note: when using flask without awsgi like so:

@app.route('/', methods=['POST'])
def test():
    return request.get_json()

everything is working, but when i use awsgi:

def lambda_handler(event, context):
    return awsgi.response(app, event, context)

@bp.route('/<id>', methods=[METHOD])
def update_customer(id, query_params={}):
    return request.get_json()

This throw me a BadRequest error and the error is on get_json.

I don't really know what awsgi is doing with the json body, but something is done incorrectly.

Environment

  • Python version: 3.7.4
  • Flask version: 1.1.1
  • Werkzeug version: 0.16.0

oliviercperrier avatar Nov 13 '19 19:11 oliviercperrier

Hi, @oliviercperrier. Thanks for reporting this issue.

Can you provide a list of steps to reproduce the issue? Without a sample of the response body or any demonstration, I don't think I'll be able to troubleshoot this.

Thanks!

slank avatar Feb 24 '20 17:02 slank