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

Function test_implicit_head

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

Source from the content-addressed store, hash-verified

139
140
141def test_implicit_head(app, client):
142 class Index(flask.views.MethodView):
143 def get(self):
144 return flask.Response("Blub", headers={"X-Method": flask.request.method})
145
146 app.add_url_rule("/", view_func=Index.as_view("index"))
147 rv = client.get("/")
148 assert rv.data == b"Blub"
149 assert rv.headers["X-Method"] == "GET"
150 rv = client.head("/")
151 assert rv.data == b""
152 assert rv.headers["X-Method"] == "HEAD"
153
154
155def test_explicit_head(app, client):

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