Closed pagidas closed 5 years ago
Django's Redirect mechanism for views (which always adds a trailing slash at the end for correct resource request) does not hold the state of the request. So when we send data in JSON format in POST, the body is not send back. Thus, the call must be made explicitly at POST /register/ (adding a slash at the end manually)
Then if we hit GET /users
I have one question. Why the body of the POST request has that structure? Couldn't it be as following?
{
"name": "Nikos",
"surname": "Giachoudis",
"username": "lpax",
"password": "1234"
}
@elpaxoudis The body of the POST request can be exactly as you said, too. But it is a good practice, when I am reading the code, to know that I parse the request body with a key named 'user'. I did it to experiment with a the parser, too. If you have trouble making that kind of request, I could change it.
Solves #32