MCPcopy Create free account
hub / github.com/Effect-TS/effect / events

Function events

packages/effect/test/httpapi/HttpApiClient.test.ts:267–281  ·  view source on GitHub ↗
(api: HttpApi.HttpApi<"Api", typeof Group>)

Source from the content-addressed store, hash-verified

265 })
266 )
267 const events = (api: HttpApi.HttpApi<"Api", typeof Group>) =>
268 HttpApiClient.makeWith(api, {
269 baseUrl: "http://test",
270 httpClient: clientFromResponse(() =>
271 new Response(textStream([`data: ${JSON.stringify(adaWithExtra)}\n\n`]), {
272 headers: { "content-type": "text/event-stream", "x-count": "1" }
273 })
274 )
275 }).pipe(
276 Effect.flatMap((client) => client.test.events({})),
277 Effect.flatMap(({ body, headers }) =>
278 Effect.map(Stream.runCollect(body), (events) => ({ events, headers }))
279 ),
280 Effect.exit
281 )
282
283 const api = HttpApi.make("Api").add(Group)
284 .annotate(HttpApi.ParseOptions, Strict)

Callers 1

Calls 5

clientFromResponseFunction · 0.85
textStreamFunction · 0.85
pipeMethod · 0.65
eventsMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected