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

Function searchParamsParser

packages/effect/src/unstable/http/HttpMiddleware.ts:274–286  ·  view source on GitHub ↗
(
  httpApp: Effect.Effect<HttpServerResponse, E, R>
)

Source from the content-addressed store, hash-verified

272 * @since 4.0.0
273 */
274export const searchParamsParser = <E, R>(
275 httpApp: Effect.Effect<HttpServerResponse, E, R>
276): Effect.Effect<Response.HttpServerResponse, E, HttpServerRequest | Exclude<R, Request.ParsedSearchParams>> =>
277 Effect.withFiber((fiber) => {
278 const services = fiber.context
279 const request = Context.getUnsafe(services, HttpServerRequest)
280 const params = Request.searchParamsFromURL(new URL(request.originalUrl))
281 return Effect.provideService(
282 httpApp,
283 Request.ParsedSearchParams,
284 params
285 ) as any
286 })
287
288/**
289 * Middleware that handles CORS preflight requests and adds configured CORS headers to HTTP responses.

Callers

nothing calls this directly

Calls 1

getUnsafeMethod · 0.80

Tested by

no test coverage detected