diff seobeo/snapshot_creator.c @ 128:7eb79fd91c7e

[Misc] Fixed all bazel targets. I should creat a separate scripts for these lol.
author June Park <parkjune1995@gmail.com>
date Thu, 08 Jan 2026 19:20:56 -0800
parents e7899c93da77
children
line wrap: on
line diff
--- a/seobeo/snapshot_creator.c	Thu Jan 08 18:05:47 2026 -0800
+++ b/seobeo/snapshot_creator.c	Thu Jan 08 19:20:56 2026 -0800
@@ -186,6 +186,7 @@
   {
     fprintf(stderr, "  ✗ Status mismatch: expected %d, got %d\n",
             config->expected_status, p_resp->status_code);
+    // fprintf(stderr, "%s", p_resp->body);
     Seobeo_Client_Response_Destroy(p_resp);
     Seobeo_Client_Request_Destroy(p_req);
     return -1;
@@ -193,21 +194,6 @@
 
   printf("  ✓ Status: %d\n", p_resp->status_code);
 
-  // Build full HTTP response
-  size_t response_len = 0;
-  char *response = build_full_response(p_resp, &response_len);
-
-  Seobeo_Client_Response_Destroy(p_resp);
-  Seobeo_Client_Request_Destroy(p_req);
-
-  if (!response || response_len == 0)
-  {
-    fprintf(stderr, "  ✗ Failed to build response\n");
-    if (response)
-      free(response);
-    return -1;
-  }
-
   // Generate snapshot filename
   char filename[256];
   path_to_filename(config->path, filename, sizeof(filename));
@@ -216,18 +202,19 @@
   snprintf(filepath, sizeof(filepath), "%s/%s", config->snapshot_dir, filename);
 
   // Write snapshot
-  if (write_snapshot(filepath, response, response_len) == 0)
+  if (write_snapshot(filepath, p_resp->body, p_resp->body_length) == 0)
   {
-    printf("  ✓ Snapshot saved: %s (%zu bytes)\n", filepath, response_len);
-    free(response);
+    printf("  ✓ Snapshot saved: %s (%zu bytes)\n", filepath, p_resp->body_length);
     return 0;
   }
   else
   {
     fprintf(stderr, "  ✗ Failed to write snapshot: %s\n", filepath);
-    free(response);
     return -1;
   }
+
+  Seobeo_Client_Response_Destroy(p_resp);
+  Seobeo_Client_Request_Destroy(p_req);
 }
 
 int Seobeo_Snapshots_Create_Batch(const SnapshotConfig configs[], int count)
@@ -238,13 +225,9 @@
   for (int i = 0; i < count; i++)
   {
     if (Seobeo_Snapshot_Create(&configs[i]) == 0)
-    {
       passed++;
-    }
     else
-    {
       failed++;
-    }
     printf("\n");
   }