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

Function layerProtocolHttp

packages/effect/src/unstable/rpc/RpcClient.ts:989–1001  ·  view source on GitHub ↗
(options: {
  readonly url: string
  readonly transformClient?: <E, R>(client: HttpClient.HttpClient.With<E, R>) => HttpClient.HttpClient.With<E, R>
})

Source from the content-addressed store, hash-verified

987 * @since 4.0.0
988 */
989export const layerProtocolHttp = (options: {
990 readonly url: string
991 readonly transformClient?: <E, R>(client: HttpClient.HttpClient.With<E, R>) => HttpClient.HttpClient.With<E, R>
992}): Layer.Layer<Protocol, never, RpcSerialization.RpcSerialization | HttpClient.HttpClient> =>
993 Layer.effect(Protocol)(
994 Effect.flatMap(
995 HttpClient.HttpClient,
996 (client) => {
997 client = HttpClient.mapRequest(client, HttpClientRequest.prependUrl(options.url))
998 return makeProtocolHttp(options.transformClient ? options.transformClient(client) : client)
999 }
1000 )
1001 )
1002
1003/**
1004 * Creates a client `Protocol` over the current `Socket`, using the current

Callers

nothing calls this directly

Calls 1

makeProtocolHttpFunction · 0.85

Tested by

no test coverage detected