The add_movie() function return the length of movies as the last id, so the first get request should return id: 3 rather than id: 2 (in the image of post response). And in other function, use index to access movie. So, I think should change return {'id': len(movies), 200 to return {'id': len(movies) - 1, 200 in the code.
Sorry for my poor english.
Thanks for the tutorial!
There may be some error codes here:
The
add_movie()
function return the length of movies as the last id, so the first get request should returnid: 3
rather thanid: 2
(in the image of post response). And in other function, use index to access movie. So, I think should changereturn {'id': len(movies), 200
toreturn {'id': len(movies) - 1, 200
in the code.Sorry for my poor english.
Yes, that's right. I never realized it. Thanks for pointing it out.
Also, your English is good :)
I will update the article shortly.
I want to point another thing here, the response code should be 201 because we are creating an object, or Am I wrong?