| 200 | |
| 201 | /** @internal */ |
| 202 | export const searchParamsParser = <E, R>(httpApp: App.Default<E, R>) => |
| 203 | Effect.withFiberRuntime< |
| 204 | HttpServerResponse, |
| 205 | E, |
| 206 | ServerRequest.HttpServerRequest | Exclude<R, ServerRequest.ParsedSearchParams> |
| 207 | >((fiber) => { |
| 208 | const context = fiber.currentContext |
| 209 | const request = Context.unsafeGet(context, ServerRequest.HttpServerRequest) |
| 210 | const params = ServerRequest.searchParamsFromURL(new URL(request.originalUrl)) |
| 211 | return Effect.locally( |
| 212 | httpApp, |
| 213 | FiberRef.currentContext, |
| 214 | Context.add(context, ServerRequest.ParsedSearchParams, params) |
| 215 | ) as any |
| 216 | }) |
| 217 | |
| 218 | /** @internal */ |
| 219 | export const cors = (options?: { |