Request: Route Checking and Response
- Dominant language
- Python
- Stars
- 11.1k
- Forks
- 1k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 2
Description
It's extremely easy setup routes. However, this means it's also easy to make a mistake. The current error message on a bad route is ambiguous and doesn't seem to relate to the missing route. For example, given the below route without the leading `/`:
```
@app.route('status', cors=True)
def index():
return {'status': 'available'}
```
A request returns:
```
> http localhost:8000/status
HTTP/1.1 403 Forbidden
Content-Length: 43
Content-Type: application/json
Date: Tue, 05 Dec 2017 18:06:30 GMT
Server: BaseHTTP/0.3 Python/2.7.12
x-amzn-ErrorType: UnauthorizedException
x-amzn-RequestId: 52e78aea-aaf5-455e-8f6f-fece9ceffc80
{
"message": "Missing Authentication Token"
}
```
It would make more sense to have information about a bad route. Or perhaps providing a console warning about a request to a non-existent route. Currently the console only shows a `403`:
```
> chalice local
Serving on localhost:8000
127.0.0.1 - - [05/Dec/2017 10:06:30] "GET /status HTTP/1.1" 403 - # response when above request is made
```
Contributor guide
Research direction
Start with chalice local and the app.route('status', cors=True) example; reproduce the GET /status response and inspect how nonexistent routes are handled. Define the expected route-specific response or console warning, then verify that malformed or missing routes no longer produce the ambiguous 403 and “Missing Authentication Token” output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100