Type-Safe JSON Body in HTTP Request

How do I add a type-safe json body to an http request?
This is what I'm trying:
const preSignUrl = (fileType: string) =>
  HttpClient.request
    .post(`/api/photo/upload`)
    .pipe(
      HttpClient.request.schemaBody(photo.SignUrlPayload),
      HttpClient.client.fetchOk,
      HttpClient.response.schemaBodyJsonScoped(photo.SignUrlPayload),
      Effect.retry(retryPolicy),
      Effect.withLogSpan("preSignUrl"),
    );
Was this page helpful?