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

Function app

tests/middleware/test_proxy_fix.py:166–181  ·  view source on GitHub ↗
(request)

Source from the content-addressed store, hash-verified

164
165 @Request.application
166 def app(request):
167 # for header
168 assert request.remote_addr == "192.168.0.1"
169 # proto, host, port, prefix headers
170 assert request.url_root == url_root
171
172 urls = url_map.bind_to_environ(request.environ)
173 parrot_url = urls.build("parrot")
174 # build includes prefix
175 assert urls.build("parrot") == "/".join((request.script_root, "parrot"))
176 # match doesn't include prefix
177 assert urls.match("/parrot")[0] == "parrot"
178
179 # With autocorrect_location_header enabled, location header will
180 # start with url_root
181 return redirect(parrot_url)
182
183 url_map = Map([Rule("/parrot", endpoint="parrot")])
184 app = ProxyFix(app, **kwargs)

Callers

nothing calls this directly

Calls 4

redirectFunction · 0.90
bind_to_environMethod · 0.80
buildMethod · 0.45
matchMethod · 0.45

Tested by

no test coverage detected