pallets-eco / flask-jwt

JWT (JSON Web Tokens) for Flask applications
MIT License
564 stars 178 forks source link

raise exception if invalid json in body #71

Open jbouzekri opened 8 years ago

jbouzekri commented 8 years ago

It was throwing this error :

Traceback (most recent call last):
  File "/home/jobou/workspace/weenect-api/venv/lib/python3.4/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/jobou/workspace/weenect-api/venv/lib/python3.4/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/jobou/workspace/weenect-api/venv/lib/python3.4/site-packages/flask_jwt/__init__.py", line 115, in _default_auth_request_handler
    username = data.get(current_app.config.get('JWT_AUTH_USERNAME_KEY'), None)
AttributeError: 'NoneType' object has no attribute 'get'
stephane commented 8 years ago

Merged with #70 in my current fork https://github.com/webstack/flask-jwt/commits/fork