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

Function htmlStream

packages/effect/src/http/HttpServerResponse.ts:276–296  ·  view source on GitHub ↗
(
  strings: TemplateStringsArray,
  ...args: A
)

Source from the content-addressed store, hash-verified

274 * @since 4.0.0
275 */
276export const htmlStream = <
277 A extends ReadonlyArray<Template.InterpolatedWithStream>
278>(
279 strings: TemplateStringsArray,
280 ...args: A
281): Effect.Effect<
282 HttpServerResponse,
283 never,
284 Template.Interpolated.Context<A[number]>
285> =>
286 Effect.map(
287 Effect.context<Template.Interpolated.Context<A[number]>>(),
288 (context) =>
289 stream(
290 Stream.provideContext(
291 Stream.encodeText(Template.stream(strings, ...args)),
292 context
293 ),
294 { contentType: "text/html" }
295 )
296 )
297
298/**
299 * Creates a JSON HTTP response.

Callers

nothing calls this directly

Calls 4

contextMethod · 0.80
streamFunction · 0.70
streamMethod · 0.65
mapMethod · 0.45

Tested by

no test coverage detected