MCPcopy
hub / github.com/pallets/flask / test_explicit_head

Function test_explicit_head

tests/test_views.py:155–168  ·  view source on GitHub ↗
(app, client)

Source from the content-addressed store, hash-verified

153
154
155def test_explicit_head(app, client):
156 class Index(flask.views.MethodView):
157 def get(self):
158 return "GET"
159
160 def head(self):
161 return flask.Response("", headers={"X-Method": "HEAD"})
162
163 app.add_url_rule("/", view_func=Index.as_view("index"))
164 rv = client.get("/")
165 assert rv.data == b"GET"
166 rv = client.head("/")
167 assert rv.data == b""
168 assert rv.headers["X-Method"] == "HEAD"
169
170
171def test_endpoint_override(app):

Callers

nothing calls this directly

Calls 4

as_viewMethod · 0.80
headMethod · 0.80
add_url_ruleMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected