code: def test_receive_event_by_http(workflow_start_regular_shared_serve):
      """This test has a statically declared event workflow task,
      receiving one externally posted message to a Ray Serve endpoint.
      """
  
      def send_event():
          resp = requests.post(
              "http://127.0.0.1:8000/event/send_event/"
              + "workflow_test_receive_event_by_http",
              json={
                  "event_key": "event_key",
                  "event_payload": "event_message",
              },
          )
          return resp
  
      event_promise = workflow.wait_for_event(
          HTTPListener, event_key="event_key"
      )
      workflow.run_async(
          event_promise,
          workflow_id="workflow_test_receive_event_by_http",
      )
  
      # wait until HTTPEventProvider is ready
      def check_app_running():
          status = serve.status().applications[
              common.HTTP_EVENT_PROVIDER_NAME
          ]
          assert status.status == "RUNNING"
          return True
  
      wait_for_condition(check_app_running)
  
      # repeat send_event() until the returned status code is not 404
      while True:
          res = send_event()
          if res.status_code == 404:
              sleep(0.5)
          else:
              break
  
      key, event_msg = workflow.get_output(
          workflow_id="workflow_test_receive_event_by_http"
      )
  
      assert event_msg == "event_message"
  
file_path: ray/python/ray/workflow/tests/test_http_events.py
imports: from time import sleep
  import pytest
  import ray
  from ray import workflow
  from ray.workflow.http_event_provider import HTTPListener
  from ray.tests.conftest import *
  from ray import serve
  from ray.workflow import common
  from ray._private.test_utils import wait_for_condition
  import requests
label_desc: Use image node_id 1 for calling a global function with example usage: test_receive_event_by_http(workflow_start_regular_shared_serve) and returns: resp, True