Refactored HttpClient Pipeline in 3.8.*: How to Use `HttpClientResponse.arrayBuffer`

Hi, quick question

I use 3.8.* effect and HttpClient has been refactored.

I had this pipeline, that used HttpClientResponse.arrayBuffer, how it should like now? I'm still not confident when using these Http client combinators 🙂

    pipe(
      Effect.Do,
      Effect.bind("httpClient", () =>
        HttpClient.HttpClient
      ),
      Effect.let("baseUrl", () => "https://api.anthropic.com/"),
      Effect.let("client", ({ httpClient, baseUrl }) =>
        httpClient.pipe(
          HttpClient.mapRequest(
            HttpClientRequest.setHeaders({
              "anthropic-version": "2023-06-01"
            })
          ),
          HttpClient.mapRequest(
            HttpClientRequest.prependUrl(baseUrl)
          ),
          HttpClient.transformResponse(
            HttpClientResponse.arrayBuffer
          ),
        ),
      ),
Was this page helpful?