rpkilby / dj-jsonapi

A JSON-API server implementation built for Django on top of Django Rest Framework
Other
0 stars 1 forks source link

Router handling of 404's for URLs not in route structure #11

Open rpkilby opened 9 years ago

rpkilby commented 9 years ago

Should the router handle 404's for URL's not in its route structure?

The argument for, is that any route under /my-api/ should be considered part of the API - even invalid routes such as /my-api/foobar. In this case, it's the responsibility of the API to return a JSON-API compliant error response.

The argument against is that only defined routes should be considered part of the API. An undefined route would not be naturally reachable by traversing the API with a properly behaving client. The only way to reach these URLs would be through a malformed client and/or through a user manually forming such a request.