MCPcopy Create free account
hub / github.com/CopilotKit/aimock / writeErrorResponse

Function writeErrorResponse

src/sse-writer.ts:141–154  ·  view source on GitHub ↗
(
  res: http.ServerResponse,
  status: number,
  body: string,
  options?: ErrorResponseOptions,
)

Source from the content-addressed store, hash-verified

139}
140
141export function writeErrorResponse(
142 res: http.ServerResponse,
143 status: number,
144 body: string,
145 options?: ErrorResponseOptions,
146): void {
147 const headers: Record<string, string> = { "Content-Type": "application/json" };
148 if (status === 429) {
149 headers["Retry-After"] = String(options?.retryAfter ?? 1);
150 Object.assign(headers, RATE_LIMIT_HEADERS);
151 }
152 res.writeHead(status, headers);
153 res.end(body);
154}

Callers 15

proxyErrorFunction · 0.85
handleVideoCreateFunction · 0.85
handleVideoStatusFunction · 0.85
handleOllamaFunction · 0.85
handleOllamaGenerateFunction · 0.85
handleOllamaEmbeddingsFunction · 0.85
handleConverseFunction · 0.85
handleConverseStreamFunction · 0.85
handleCohereFunction · 0.85

Calls 1

endMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…