aws / aws/chalice

query_params is NoneType if URL contains parameters

Open
#2,001 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
11.1k
Forks
1k
Avg merge
1d 22h
Merged PRs (30d)
2

Description

The following example called with `http:///api/sensor1?property=tempurature` fails with `AttributeError: 'NoneType' object has no attribute 'get'` when calling get on `query_params`

```
@app.route("/{sensor}", methods=["POST", "GET"], content_types=["application/json"])
def sensor_info(sensor):
if app.current_request.method == "GET":
property = app.current_request.query_params.get("property", None)
res = some_db_query()
return res
```

Perhaps I am missing something, but from the examples I have seen, this should work as expected (i.e. query_params should exist).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.