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

Function application_framable_response

src/daemon/application.c:3090–3097  ·  view source on GitHub ↗

Decide whether `response` can be framed, substituting the error when it * cannot. Owns `response` either way and returns the reply to send, or NULL * only on allocation failure. This is ONE function on purpose: the bug was the * DECISION (an oversized reply travelling on as if it were fine), so the * decision and the substitution have to be testable together — a test that * only builds the er

Source from the content-addressed store, hash-verified

3088 * decision and the substitution have to be testable together — a test that
3089 * only builds the error passes even with the size check removed. */
3090static char *application_framable_response(char *response, const cbm_jsonrpc_request_t *request) {
3091 if (!response || strlen(response) <= CBM_DAEMON_RUNTIME_APPLICATION_PAYLOAD_MAX) {
3092 return response;
3093 }
3094 char *replacement = application_oversized_response_error(request, strlen(response));
3095 free(response);
3096 return replacement;
3097}
3098
3099char *cbm_daemon_application_framable_response_for_test(char *response,
3100 const cbm_jsonrpc_request_t *request) {

Tested by

no test coverage detected