frictionlessdata / goodtables.io

Data validation as a service. Project retired, got to the current one at frictionsless/repository
https://goodtables.io
GNU Affero General Public License v3.0
69 stars 16 forks source link

Exception when not providing `name` in new source endpoint #252

Open amercader opened 7 years ago

amercader commented 7 years ago
ERROR:goodtablesio.blueprints.api:AttributeError("'NoneType' object has no attribute 'get'",)
Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/flask/app.py", line 1639, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/lib/python3.5/site-packages/flask/app.py", line 1625, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/srv/app/goodtablesio/utils/backend.py", line 49, in decorated_view
    return view(*args, user=user, **kwargs)
  File "/srv/app/goodtablesio/blueprints/api.py", line 62, in source_create
    name = data.get('name')
AttributeError: 'NoneType' object has no attribute 'get'
roll commented 7 years ago

@amercader I would say if not providing payload at all (may be incorrect content-type?)

amercader commented 7 years ago

You are right, I didn't send any payload

roll commented 7 years ago

I think we still need to rename this issue and fix by returning API Error and 400 if no payload. Could be low priority..