MCPcopy
hub / github.com/cherrypy/cherrypy / stream_handler

Method stream_handler

cherrypy/test/test_tools.py:118–128  ·  view source on GitHub ↗
(next_handler, *args, **kwargs)

Source from the content-addressed store, hash-verified

116 cherrypy.tools.rotator = cherrypy.Tool('before_finalize', Rotator())
117
118 def stream_handler(next_handler, *args, **kwargs):
119 actual = cherrypy.request.config.get('tools.streamer.arg')
120 assert actual == 'arg value'
121 cherrypy.response.output = o = io.BytesIO()
122 try:
123 next_handler(*args, **kwargs)
124 # Ignore the response and return our accumulated output
125 # instead.
126 return o.getvalue()
127 finally:
128 o.close()
129 cherrypy.tools.streamer = cherrypy._cptools.HandlerWrapperTool(
130 stream_handler)
131

Callers

nothing calls this directly

Calls 2

getMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected