code: def _respond(self, code=200, headers=None, data=b""):
      headers = headers or {}
      headers.update({"User-Agent": "test"})
      self.send_response(code)
      for k, v in headers.items():
          self.send_header(k, str(v))
      self.end_headers()
      if data:
          self.wfile.write(data)
  
file_path: ray/python/ray/data/tests/mock_http_server.py
imports: import contextlib
  import threading
  from http.server import BaseHTTPRequestHandler, HTTPServer
  import pytest
label_desc: Use image node_id 2 for calling the HTTPTestHandler obj's underlying member method code with example usage: obj._respond(code, headers, data) without return types