Skip to content

Commit ed73c1f

Browse files
committed
add back transformClient
1 parent b8d319e commit ed73c1f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

packages/platform-node/examples/api.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ export class Authentication extends HttpApiMiddleware.Tag<Authentication>()("Aut
3939
}
4040
}) {}
4141

42+
const idParam = HttpApiSchema.param("id", Schema.NumberFromString)
43+
4244
class UsersApi extends HttpApiGroup.make("users")
4345
.add(
44-
HttpApiEndpoint.get("findById")`/${HttpApiSchema.param("id", Schema.NumberFromString)}`
46+
HttpApiEndpoint.get("findById")`/${idParam}`
4547
.addSuccess(User)
4648
.setHeaders(Schema.Struct({
4749
page: Schema.NumberFromString.pipe(

packages/platform/src/HttpApiClient.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ const makeClient = <ApiId extends string, Groups extends HttpApiGroup.Any, ApiEr
250250
export const make = <ApiId extends string, Groups extends HttpApiGroup.Any, ApiError, ApiR>(
251251
api: HttpApi.HttpApi<ApiId, Groups, ApiError, ApiR>,
252252
options?: {
253+
readonly transformClient?: ((client: HttpClient.HttpClient) => HttpClient.HttpClient) | undefined
253254
readonly transformResponse?:
254255
| ((effect: Effect.Effect<unknown, unknown>) => Effect.Effect<unknown, unknown>)
255256
| undefined
@@ -263,7 +264,7 @@ export const make = <ApiId extends string, Groups extends HttpApiGroup.Any, ApiE
263264
Effect.flatMap(HttpClient.HttpClient, (httpClient) =>
264265
makeWith(api, {
265266
...options,
266-
httpClient
267+
httpClient: options?.transformClient ? options.transformClient(httpClient) : httpClient
267268
}))
268269

269270
/**

0 commit comments

Comments
 (0)