code: def test_echo_stream_inference(model_name, params):
      """
      Full circle test with torchserve
      """
      STREAM = params[0]
      EXPECTED_RESPONSES = params[1]
  
      response = requests.post(
          url=f"http://localhost:8080/predictions/{model_name}",
          data=json.dumps(42),
          stream=STREAM,
      )
  
      assert response.status_code == 200
  
      assert response.headers["Transfer-Encoding"] == "chunked"
  
      prediction = []
      for chunk in response.iter_content(chunk_size=None):
          if chunk:
              prediction += [chunk.decode("utf-8")]
  
      assert len(prediction) == EXPECTED_RESPONSES
  
      assert str("".join(prediction)) == "hellohellohellohello world "
  
file_path: serve/test/pytest/test_send_intermediate_prediction_response.py
imports: import json
  import shutil
  from pathlib import Path
  from unittest.mock import patch
  import pytest
  import requests
  import test_utils
  from model_archiver import ModelArchiverConfig
label_desc: Use image node_id 5 for calling a global function with example usage: test_echo_stream_inference(model_name, params) without return types