@@ -90,7 +90,8 @@ def app(environ, start_response):
90
90
91
91
# Get the data from the route. This data is typically the output
92
92
# of the controller method
93
- data = router .get (route .route , route .output (request ))
93
+ if not request .redirect_url :
94
+ data = router .get (route .route , route .output (request ))
94
95
95
96
# Loads the request in so the middleware specified is able to use the
96
97
# request object. This is after middleware and is ran after the request
@@ -133,19 +134,20 @@ def app(environ, start_response):
133
134
data = router .get (route .route , route .output (request ))
134
135
request .redirect_url = route .route_url
135
136
136
- # Convert the data that is retrieved above to bytes so the wsgi server can handle it.
137
- data = bytes (data , 'utf-8' )
138
-
139
137
if not request .redirect_url :
138
+ # Convert the data that is retrieved above to bytes so the wsgi server can handle it.
139
+ data = bytes (data , 'utf-8' )
140
+
140
141
# Normal HTTP response.
141
142
start_response ("200 OK" , [
142
143
("Content-Type" , "text/html; charset=utf-8" ),
143
144
("Content-Length" , str (len (data )))
144
145
] + request .get_cookies ())
145
146
else :
147
+ data = bytes ('redirecting ..' , 'utf-8' )
146
148
# Redirection. In order to redirect the response types need to be 302 instead of 200
147
149
start_response ("302 OK" , [
148
- ('Location' , request .redirect_url )
150
+ ('Location' , request .compile_route_to_url () )
149
151
] + request .get_cookies ())
150
152
151
153
# This will output the data to the browser.
0 commit comments