comparison hg-web/main.c @ 223:0e7b9464248d hg-web

[hg-web] Add browser route regression coverage
author MrJuneJune <me@mrjunejune.com>
date Sun, 02 Aug 2026 10:07:40 -0700
parents ce7f4400c2de
children 3007ef5fc0ed
comparison
equal deleted inserted replaced
222:a8d6435dc021 223:0e7b9464248d
342 char hg_path[MAX_PATH_LENGTH]; 342 char hg_path[MAX_PATH_LENGTH];
343 int length = snprintf(hg_path, sizeof(hg_path), "/raw-file/tip/%s", encoded); 343 int length = snprintf(hg_path, sizeof(hg_path), "/raw-file/tip/%s", encoded);
344 if (length < 0 || (size_t)length >= sizeof(hg_path)) 344 if (length < 0 || (size_t)length >= sizeof(hg_path))
345 return text_response(arena, "400", "text/plain", "README path is too long"); 345 return text_response(arena, "400", "text/plain", "README path is too long");
346 346
347 return forward_hg_response( 347 Seobeo_Client_Response *hg_response =
348 hg_proxy_request("GET", hg_path, NULL, 0, NULL, "text/markdown"), 348 hg_proxy_request("GET", hg_path, NULL, 0, NULL, "text/markdown");
349 "text/markdown", 349 if (hg_response && hg_response->status_code == HTTP_NOT_FOUND)
350 arena); 350 {
351 Seobeo_Client_Response_Destroy(hg_response);
352 return text_response(arena, "204", "text/markdown", "");
353 }
354 return forward_hg_response(hg_response, "text/markdown", arena);
351 } 355 }
352 356
353 Seobeo_Request_Entry *ApiGetGraph(Seobeo_Request_Entry *request, Dowa_Arena *arena) 357 Seobeo_Request_Entry *ApiGetGraph(Seobeo_Request_Entry *request, Dowa_Arena *arena)
354 { 358 {
355 const char *graph_id = map_value_case_insensitive(request, ":graph_id"); 359 const char *graph_id = map_value_case_insensitive(request, ":graph_id");