Skip to content

Commit cc5ac77

Browse files
Merge pull request #60 from josephmancuso/v0.3.3
v0.3.3 Release
2 parents e8627a1 + 3679a90 commit cc5ac77

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

bootstrap/start.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ def app(environ, start_response):
9090

9191
# Get the data from the route. This data is typically the output
9292
# 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))
9495

9596
# Loads the request in so the middleware specified is able to use the
9697
# request object. This is after middleware and is ran after the request
@@ -133,19 +134,20 @@ def app(environ, start_response):
133134
data = router.get(route.route, route.output(request))
134135
request.redirect_url = route.route_url
135136

136-
# Convert the data that is retrieved above to bytes so the wsgi server can handle it.
137-
data = bytes(data, 'utf-8')
138-
139137
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+
140141
# Normal HTTP response.
141142
start_response("200 OK", [
142143
("Content-Type", "text/html; charset=utf-8"),
143144
("Content-Length", str(len(data)))
144145
] + request.get_cookies())
145146
else:
147+
data = bytes('redirecting ..', 'utf-8')
146148
# Redirection. In order to redirect the response types need to be 302 instead of 200
147149
start_response("302 OK", [
148-
('Location', request.redirect_url)
150+
('Location', request.compile_route_to_url())
149151
] + request.get_cookies())
150152

151153
# This will output the data to the browser.

0 commit comments

Comments
 (0)