MCPcopy
hub / github.com/pallets/werkzeug / RequestRedirect

Class RequestRedirect

src/werkzeug/routing/exceptions.py:28–46  ·  view source on GitHub ↗

Raise if the map requests a redirect. This is for example the case if `strict_slashes` are activated and an url that requires a trailing slash. The attribute `new_url` contains the absolute destination url.

Source from the content-addressed store, hash-verified

26
27
28class RequestRedirect(HTTPException, RoutingException):
29 """Raise if the map requests a redirect. This is for example the case if
30 `strict_slashes` are activated and an url that requires a trailing slash.
31
32 The attribute `new_url` contains the absolute destination url.
33 """
34
35 code = 308
36
37 def __init__(self, new_url: str) -> None:
38 super().__init__(new_url)
39 self.new_url = new_url
40
41 def get_response(
42 self,
43 environ: WSGIEnvironment | Request | None = None,
44 scope: dict[str, t.Any] | None = None,
45 ) -> Response:
46 return redirect(self.new_url, self.code)
47
48
49class RequestPath(RoutingException):

Callers 1

matchMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected