MCPcopy Create free account
hub / github.com/pallets/flask / test_request_processing

Function test_request_processing

tests/test_basic.py:681–703  ·  view source on GitHub ↗
(app, client)

Source from the content-addressed store, hash-verified

679
680
681def test_request_processing(app, client):
682 evts = []
683
684 @app.before_request
685 def before_request():
686 evts.append("before")
687
688 @app.after_request
689 def after_request(response):
690 response.data += b"|after"
691 evts.append("after")
692 return response
693
694 @app.route("/")
695 def index():
696 assert "before" in evts
697 assert "after" not in evts
698 return "request"
699
700 assert "after" not in evts
701 rv = client.get("/").data
702 assert "after" in evts
703 assert rv == b"request|after"
704
705
706def test_request_preprocessing_early_return(app, client):

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected