I study web dev. Now I am studying forms. Namely: when you post a data always redirect to the success url.
I use Django. So, I made a FormHandler (show form, validate, redirect in case of success) and ThanksHandler (show "Thanks").
Then in Chrome with open dev tools (F12) on network tab: 1. http://localhost:8000/form/
form/ 200 Document
-
Input valid data. Submit.
form/ 302 text/html thanks 301 text/html http://localhost:8000/form/ thanks/ 200 document http://localhost:8000/thanks
I understand the scheme 1. You send a GET request. 2. The browser sends form HTML. 3. You send a post answer. 4. The server sends response for redirection. 5. You browser automatically sends GET request to the success url. 6. The server sends you HTML of success page.
Three round trips. And we can clearly see 3 requests in the network tab.
The question is: why the first line turned into 302?
Aucun commentaire:
Enregistrer un commentaire