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

Method encode_response

gunicorn/dirty/protocol.py:207–222  ·  view source on GitHub ↗

Encode a success response message. Args: request_id: Request identifier this responds to result: Result value (must be TLV-serializable) Returns: bytes: Complete message (header + payload)

(request_id: int, result)

Source from the content-addressed store, hash-verified

205
206 @staticmethod
207 def encode_response(request_id: int, result) -> bytes:
208 """
209 Encode a success response message.
210
211 Args:
212 request_id: Request identifier this responds to
213 result: Result value (must be TLV-serializable)
214
215 Returns:
216 bytes: Complete message (header + payload)
217 """
218 payload_dict = {"result": result}
219 payload = TLVEncoder.encode(payload_dict)
220 header = BinaryProtocol.encode_header(MSG_TYPE_RESPONSE, request_id,
221 len(payload))
222 return header + payload
223
224 @staticmethod
225 def encode_error(request_id: int, error) -> bytes:

Calls 2

encodeMethod · 0.80
encode_headerMethod · 0.80