Question

Im using my below code to display a page..This page startpage is called from the Login page. When the user post username and password it correctly calls the POST request..

Now, if I navigate to this startpage from some other page through back or front button, what method will get executed "GET" or "POST"?

@app.route('/StartPage',method='GET')
def test():
    print 'In get'

@app.route('/StartPage',method='POST')
def retrieve():

   username = request.forms.get('username')
   password = request.forms.get('password')

   return template('LoginPage')

This is written in Bottle framework

Was it helpful?

Solution

When using back and forward, typically your browser will replay the same type of request that was originally made, so if the user was trying to login to StartPage with a POST request and given username and password, that POST request would be sent again with the same username and password.

If they originally accessed StartPage with a GET request and didn't provide a username and password, that GET request will be sent again upon using the back/forward commands. This should generally hold true across basic HTTP frameworks.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top