Note: Many pre-HTTP/1.1 user agents do not understand the 303
status. When interoperability with such clients is a concern, the
302 status code may be used instead, since most user agents react
to a 302 response as described here for 303.
As you can see here [2], simple_httpclient switches to GET only on 303 code and not on 302.
from tornado.testing import AsyncHTTPTestCase
from tornado.web import Application, RequestHandler
class TestLogin(AsyncHTTPTestCase):
def get_app(self):
class LoginHandler(RequestHandler):
def post(self):
self.redirect('/')
class IndexHandler(RequestHandler):
def get(self):
self.write('ok')
return Application([('/', IndexHandler), ('/login', LoginHandler)])
def test_login(self):
res = self.fetch('/login', method = 'POST', body = 'bla')
self.assertEqual(res.code, 200)
self.assertEqual(res.body, 'ok')