MCPcopy Create free account
hub / github.com/EvoMap/evolver / makeSlowStream

Function makeSlowStream

test/proxyStreaming.test.js:107–118  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

105 cancelled = false;
106 finished = false;
107 function makeSlowStream() {
108 // Web ReadableStream so .cancel() is callable; emits one chunk fast,
109 // then waits "forever" — exactly the shape an SSE upstream takes on a
110 // long Anthropic response. The cancel callback marks observable state
111 // so the test can assert it fired.
112 return new ReadableStream({
113 start(controller) {
114 controller.enqueue(new TextEncoder().encode('data: {"type":"message_start"}\n\n'));
115 },
116 cancel() { cancelled = true; },
117 });
118 }
119 const routes = {
120 'POST /test/slow': async () => {
121 const stream = makeSlowStream();

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected