diff seobeo/tests/seobeo_sse_test.c @ 260:1f9877b637e9

Add Copilot-powered cyberpunk JRPG chat Integrate the production JRPG chat with Seobeo streaming, Deita persistence, and a Bazel-managed Copilot SDK and LiteLLM inference stack. Co-authored-by: Copilot <[email protected]>
author MrJuneJune <mrjunejune@users.noreply.github.com>
date Wed, 05 Aug 2026 09:19:41 -0700
parents 609d3c6aff4e
children 04fee26ecce0
line wrap: on
line diff
--- a/seobeo/tests/seobeo_sse_test.c	Wed Aug 05 09:19:41 2026 -0700
+++ b/seobeo/tests/seobeo_sse_test.c	Wed Aug 05 09:19:41 2026 -0700
@@ -39,6 +39,16 @@
   (void)p_arena;
 }
 
+static void post_route_handler(
+    Seobeo_SSE_Stream *p_stream,
+    Seobeo_Request_Entry *p_request,
+    Dowa_Arena *p_arena)
+{
+  (void)p_stream;
+  (void)p_request;
+  (void)p_arena;
+}
+
 static void initialize_handle(
     Seobeo_Handle *p_handle,
     int socket_fd,
@@ -179,6 +189,10 @@
   Seobeo_Router_Init();
   Seobeo_Router_Register_SSE("/events/:topic", route_handler);
   Seobeo_Router_Register_SSE("/events/:topic/fixed", route_handler);
+  Seobeo_Router_Register_SSE_Method(
+      "POST",
+      "/events/:topic",
+      post_route_handler);
   Dowa_Arena *p_arena = Dowa_Arena_Create(4096);
   Seobeo_Request_Entry *p_request = NULL;
   Seobeo_SSE_Handler handler = Seobeo_Router_Find_SSE_Handler(
@@ -191,11 +205,30 @@
       p_request,
       ":topic");
   assert(p_topic && strcmp(p_topic->value, "builds") == 0);
+  Seobeo_Request_Entry *p_post_request = NULL;
+  Dowa_HashMap_Push_Arena(
+      p_post_request,
+      "Body",
+      "deploy=release",
+      p_arena);
   assert(Seobeo_Router_Find_SSE_Handler(
       "POST",
       "/events/builds",
-      &p_request,
+      &p_post_request,
+      p_arena) == post_route_handler);
+  p_topic = Dowa_HashMap_Get_Ptr(p_post_request, ":topic");
+  Seobeo_Request_Entry *p_body = Dowa_HashMap_Get_Ptr(
+      p_post_request,
+      "Body");
+  assert(p_topic && strcmp(p_topic->value, "builds") == 0);
+  assert(p_body && strcmp(p_body->value, "deploy=release") == 0);
+  Seobeo_Request_Entry *p_wrong_method = NULL;
+  assert(Seobeo_Router_Find_SSE_Handler(
+      "PUT",
+      "/events/builds",
+      &p_wrong_method,
       p_arena) == NULL);
+  assert(Dowa_HashMap_Get_Ptr(p_wrong_method, ":topic") == NULL);
   Seobeo_Request_Entry *p_unmatched = NULL;
   assert(Seobeo_Router_Find_SSE_Handler(
       "GET",