diff options
| author | Hsiaoming Yang <me@lepture.com> | 2018-05-01 14:46:26 +0900 |
|---|---|---|
| committer | Hsiaoming Yang <me@lepture.com> | 2018-05-01 15:07:56 +0900 |
| commit | 32f8f6c622b159491d1903d8ee8f796419c76503 (patch) | |
| tree | 731e7a9f03da42dfaa9a191afa769dbf29c86a91 | |
| parent | 43fe889fe5a8c495c41ec28658f67c1f7b23e2cd (diff) | |
| download | werkzeug-fix-request-redirect.tar.gz | |
Use 302 instead of 301 for request redirect, since 301 will be cached.fix-request-redirect
| -rw-r--r-- | tests/test_routing.py | 2 | ||||
| -rw-r--r-- | werkzeug/routing.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/tests/test_routing.py b/tests/test_routing.py index 8bf5f15a..23988506 100644 --- a/tests/test_routing.py +++ b/tests/test_routing.py @@ -267,7 +267,7 @@ def test_dispatch(): ) assert dispatch('/').data == b"('root', {})" - assert dispatch('/foo').status_code == 301 + assert dispatch('/foo').status_code == 302 raise_this = r.NotFound() pytest.raises(r.NotFound, lambda: dispatch('/bar')) assert dispatch('/bar', True).status_code == 404 diff --git a/werkzeug/routing.py b/werkzeug/routing.py index 2e4e2f42..1da5e406 100644 --- a/werkzeug/routing.py +++ b/werkzeug/routing.py @@ -227,7 +227,7 @@ class RequestRedirect(HTTPException, RoutingException): The attribute `new_url` contains the absolute destination url. """ - code = 301 + code = 302 def __init__(self, new_url): RoutingException.__init__(self, new_url) |
