Reputation: 8936
urls.py
url(r'^v1/files/$', MyFileView.as_view(), name='api-upload'),
url(r'^v1/files/$', MyFileView.as_view(), name='api-view-all'),
views.py
class MyFileView(APIView):
def post():
pass
def get():
pass
My question is: why POST api/v1/files
works like GET api/v1/files/
? I thought POST api/v1/files
should return 404. Anything wrong?
UPDATE
But api/v1/files/<id>
does not have this issue. api/v1/files/<id>/
will return 404.
Thanks
Upvotes: 0
Views: 505
Reputation: 57378
I think that they don't "work like GET
".
What is really happening is that:
POST url
HTTP 302
to url/
GET url/
.And the result of that is what you actually see.
If you check the requests being actually sent along the wire, I suspect you'll see two requests - the first being the POST
, the second being the GET
.
Upvotes: 2