MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / ui_adr_post_request

Function ui_adr_post_request

tests/test_httpd.c:726–743  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

724}
725
726static int ui_adr_post_request(th_server_t *ts, const char *project, const char *content,
727 char *resp, size_t respsz) {
728 char body[2048];
729 int body_len =
730 snprintf(body, sizeof(body), "{\"project\":\"%s\",\"content\":\"%s\"}", project, content);
731 if (body_len < 0 || (size_t)body_len >= sizeof(body))
732 return 0;
733
734 char req[2304];
735 int req_len = snprintf(req, sizeof(req),
736 "POST /api/adr HTTP/1.1\r\n"
737 "Content-Type: application/json\r\n"
738 "Content-Length: %d\r\n\r\n%s",
739 body_len, body);
740 if (req_len < 0 || (size_t)req_len >= sizeof(req))
741 return 0;
742 return th_http(cbm_http_server_port(ts->srv), req, resp, respsz);
743}
744
745static int ui_adr_get_request(th_server_t *ts, const char *project, char *resp, size_t respsz) {
746 char req[512];

Callers 1

test_httpd.cFile · 0.85

Calls 2

th_httpFunction · 0.85
cbm_http_server_portFunction · 0.85

Tested by

no test coverage detected