aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/io/loader.nim5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/io/loader.nim b/src/io/loader.nim
index 2c4245c8..71cfd2ff 100644
--- a/src/io/loader.nim
+++ b/src/io/loader.nim
@@ -130,8 +130,9 @@ proc doRequest*(loader: FileLoader, request: Request, blocking = true): Response
else:
result.contenttype = guessContentType($request.url.path)
if "Location" in result.headers.table:
- let location = result.headers.table["Location"][0]
- result.redirect = parseUrl(location, some(request.url))
+ if result.status in [201, 301, 302, 303, 307, 308]:
+ let location = result.headers.table["Location"][0]
+ result.redirect = parseUrl(location, some(request.url))
# Only a stream of the response body may arrive after this point.
result.body = stream
if not blocking: