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

Function decode

packages/effect/test/httpapi/HttpApiClient.test.ts:29–33  ·  view source on GitHub ↗
(wire: string)

Source from the content-addressed store, hash-verified

27 it.effect("strict events-mode decoding omits an absent event ID", () =>
28 Effect.gen(function*() {
29 const decode = (wire: string) =>
30 HttpApiClient.makeWith(
31 StreamingApi.annotate(HttpApi.ParseOptions, { onExcessProperty: "error" }),
32 { baseUrl: "http://test", httpClient: clientFromResponse(() => new Response(textStream([wire]))) }
33 ).pipe(Effect.flatMap((client) => client.test.events({})), Effect.flatMap(Stream.runCollect))
34
35 const error = yield* Effect.flip(decode("id: 1\nevent: person\ndata: hello\n\n"))
36 assert.ok(Schema.isSchemaError(error))

Callers 2

Calls 5

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

Tested by

no test coverage detected