openfaas / python-flask-template

HTTP and Flask-based OpenFaaS templates for Python 3
MIT License
85 stars 86 forks source link

index.py throws exception if RAW_DATA not defined #37

Closed chasewalden closed 4 years ago

chasewalden commented 4 years ago

os.getenv('RAW_BODY') returns None if not defined, causing a TypeError in python3-flask-debian (potentially in others)

File "index.py", line 13, in is_true
    return len(val) > 0 and val.lower() == "true" or val == "1"
TypeError: object of type 'NoneType' has no len()

https://github.com/openfaas-incubator/python-flask-template/blob/7f9288a527b4c2b8acabb2271c38c4d3745d4310/template/python3-flask-debian/index.py#L12-L13