MCPcopy
hub / github.com/urllib3/urllib3 / endheaders

Method endheaders

src/urllib3/http2/connection.py:156–168  ·  view source on GitHub ↗
(self, message_body: typing.Any = None)

Source from the content-addressed store, hash-verified

154 self._headers.append((header, value))
155
156 def endheaders(self, message_body: typing.Any = None) -> None: # type: ignore[override]
157 if self._h2_stream is None:
158 raise ConnectionError("Must call `putrequest` first.")
159
160 with self._h2_conn as conn:
161 conn.send_headers(
162 stream_id=self._h2_stream,
163 headers=self._headers,
164 end_stream=(message_body is None),
165 )
166 if data_to_send := conn.data_to_send():
167 self.sock.sendall(data_to_send)
168 self._headers = [] # Reset headers for the next request.
169
170 def send(self, data: typing.Any) -> None:
171 """Send data to the server.

Callers 8

test_send_bytesMethod · 0.95
test_send_strMethod · 0.95
test_send_iterMethod · 0.95
test_send_file_strMethod · 0.95
test_send_file_bytesMethod · 0.95
requestMethod · 0.95
requestMethod · 0.80

Calls 1

sendallMethod · 0.45

Tested by 6

test_send_bytesMethod · 0.76
test_send_strMethod · 0.76
test_send_iterMethod · 0.76
test_send_file_strMethod · 0.76
test_send_file_bytesMethod · 0.76