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

Function layerProtocolHttp

packages/effect/src/rpc/RpcClient.ts:1266–1284  ·  view source on GitHub ↗
(options: {
  readonly url: string
  readonly transformClient?: <E, R>(client: HttpClient.HttpClient.With<E, R>) => HttpClient.HttpClient.With<E, R>
  readonly batch?: {
    readonly window: Duration.Input
    readonly maxSize?: number | undefined
  } | undefined
})

Source from the content-addressed store, hash-verified

1264 * @since 4.0.0
1265 */
1266export const layerProtocolHttp = (options: {
1267 readonly url: string
1268 readonly transformClient?: <E, R>(client: HttpClient.HttpClient.With<E, R>) => HttpClient.HttpClient.With<E, R>
1269 readonly batch?: {
1270 readonly window: Duration.Input
1271 readonly maxSize?: number | undefined
1272 } | undefined
1273}): Layer.Layer<Protocol, never, RpcSerialization.RpcSerialization | HttpClient.HttpClient> =>
1274 Layer.effect(Protocol)(
1275 Effect.flatMap(
1276 HttpClient.HttpClient,
1277 (client) => {
1278 client = HttpClient.mapRequest(client, HttpClientRequest.prependUrl(options.url))
1279 return makeProtocolHttp(options.transformClient ? options.transformClient(client) : client, {
1280 batch: options.batch
1281 })
1282 }
1283 )
1284 )
1285
1286/**
1287 * 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