Closed adabarx closed 8 years ago
I'll approve this once the default behavior for nonmapped routes are (ex: what happens when you try to access /fakepath/lol
). With this information provided, and in any event a default 404 message implemented, I think it'd be good to merge.
With the current build, accessing a false path produces this:
➜ msgboard git:(testinization) http GET http://localhost:5000/lol/jk
HTTP/1.1 404 NOT FOUND
Content-Length: 233
Content-Type: text/html
Date: Thu, 14 Jul 2016 02:18:41 GMT
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>404 Not Found</title>
<h1>Not Found</h1>
<p>The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.<
Do we want it to pass JSON data as well?
Yeah make the 404 pass a JSON dict. Something like...
{'status': 404, 'message': 'lol'}
So changing line 38 to api = flask_restful.Api(app, catch_all_404s=True)
produces the following result:
HTTP/1.1 404 NOT FOUND
Content-Length: 137
Content-Type: application/json
Date: Fri, 15 Jul 2016 19:00:33 GMT
{
"message": "The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again."
}
As for a custom 404 message... I just can't figure it out, I've been trying for the last hour and a half 😞
Add a line in 'config.py' to stop flask from adding a bunch of useless info to the end of 404 messages.
Test 404 errors when trying to list users that don't exist.