MCPcopy
hub / github.com/benoitc/gunicorn / send_trailers

Method send_trailers

gunicorn/http2/stream.py:220–236  ·  view source on GitHub ↗

Mark trailers as sent and close the stream. Args: trailers: List of (name, value) trailer tuples Raises: HTTP2StreamError: If trailers cannot be sent in current state

(self, trailers)

Source from the content-addressed store, hash-verified

218 self.response_complete = True
219
220 def send_trailers(self, trailers):
221 """Mark trailers as sent and close the stream.
222
223 Args:
224 trailers: List of (name, value) trailer tuples
225
226 Raises:
227 HTTP2StreamError: If trailers cannot be sent in current state
228 """
229 if not self.can_send:
230 raise HTTP2StreamError(
231 self.stream_id,
232 f"Cannot send trailers in state {self.state.name}"
233 )
234 self.response_trailers = trailers
235 self._half_close_local()
236 self.response_complete = True
237
238 def reset(self, error_code=0x8):
239 """Reset this stream with RST_STREAM.

Calls 2

_half_close_localMethod · 0.95
HTTP2StreamErrorClass · 0.85