Ge0rg3 / flask-parameter-validation

Get and validate all Flask input parameters with ease.
https://pypi.org/project/Flask-Parameter-Validation/
29 stars 12 forks source link

if content-type isn't application/json 'json_input' referenced before assignment #10

Closed Charlie-Mindified closed 1 year ago

Charlie-Mindified commented 1 year ago

if content-type isn't application/json json_input is never set but is still accessed on row 26 in parameter_validation.py. throws error: UnboundLocalError: local variable 'json_input' referenced before assignment

request_inputs = { Route: kwargs.copy(), Json: json_input, Query: request.args.to_dict(), Form: request.form.to_dict(), File: request.files.to_dict() } example of solution request_inputs = { Route: kwargs.copy(), Json: json_input if 'json_input' in vars() else None, Query: request.args.to_dict(), Form: request.form.to_dict(), File: request.files.to_dict() }

Ge0rg3 commented 1 year ago

Closed by #11, thanks again!