Skip to content

Commit

Permalink
HttpClientRequest.schemaBodyJson
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart committed Sep 3, 2024
1 parent 1b67897 commit 5bad4ec
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/platform-bun/examples/http-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const makeTodoService = Effect.gen(function*() {
HttpClient.mapRequest(HttpClientRequest.prependUrl("https://jsonplaceholder.typicode.com"))
)

const addTodoWithoutIdBody = HttpClientRequest.schemaBody(TodoWithoutId)
const addTodoWithoutIdBody = HttpClientRequest.schemaBodyJson(TodoWithoutId)
const create = (todo: TodoWithoutId) =>
addTodoWithoutIdBody(
HttpClientRequest.post("/todos"),
Expand Down
2 changes: 1 addition & 1 deletion packages/platform-node/examples/http-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const makeTodoService = Effect.gen(function*() {
HttpClient.mapRequest(HttpClientRequest.prependUrl("https://jsonplaceholder.typicode.com"))
)

const addTodoWithoutIdBody = HttpClientRequest.schemaBody(TodoWithoutId)
const addTodoWithoutIdBody = HttpClientRequest.schemaBodyJson(TodoWithoutId)
const create = (todo: TodoWithoutId) =>
addTodoWithoutIdBody(
HttpClientRequest.post("/todos"),
Expand Down
4 changes: 2 additions & 2 deletions packages/platform/src/HttpClientRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,13 +337,13 @@ export const bodyUnsafeJson: {
* @since 1.0.0
* @category combinators
*/
export const bodySchema: <A, I, R>(
export const schemaBodyJson: <A, I, R>(
schema: Schema.Schema<A, I, R>,
options?: ParseOptions | undefined
) => {
(body: A): (self: HttpClientRequest) => Effect.Effect<HttpClientRequest, Body.HttpBodyError, R>
(self: HttpClientRequest, body: A): Effect.Effect<HttpClientRequest, Body.HttpBodyError, R>
} = internal.bodySchema
} = internal.schemaBodyJson

/**
* @since 1.0.0
Expand Down
2 changes: 1 addition & 1 deletion packages/platform/src/internal/httpClientRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ export const bodyFileWeb = dual<
>(2, (self, file) => setBody(self, internalBody.fileWeb(file)))

/** @internal */
export const bodySchema = <A, I, R>(schema: Schema.Schema<A, I, R>, options?: ParseOptions | undefined): {
export const schemaBodyJson = <A, I, R>(schema: Schema.Schema<A, I, R>, options?: ParseOptions | undefined): {
(
body: A
): (self: ClientRequest.HttpClientRequest) => Effect.Effect<ClientRequest.HttpClientRequest, Body.HttpBodyError, R>
Expand Down

0 comments on commit 5bad4ec

Please sign in to comment.