diff options
author | bptato <nincsnevem662@gmail.com> | 2022-12-30 00:17:35 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2022-12-30 00:17:55 +0100 |
commit | 310254b09ee2dd3045648848ca9f60f9f1f7c769 (patch) | |
tree | 4c320d625e211479da3e06c5b3d6d6969e52fb68 /src/io | |
parent | 5654f1590b000a2719b7e8cb01358c6107abf520 (diff) | |
download | chawan-310254b09ee2dd3045648848ca9f60f9f1f7c769.tar.gz |
Only set Location for redirect status codes
Diffstat (limited to 'src/io')
-rw-r--r-- | src/io/loader.nim | 5 |
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: |