How to Retrieve the Full URL with Query Parameters in Effect Typescript

            const getTokenDetails = (
                snCreds: Pick<
                    Schema.Schema.Type<typeof SolarNetworkCredentials>,
                    "host" | "token" | "secret"
                >,
            ) =>
                Effect.gen(function* () {
                    const request = HttpClientRequest.get(SOLAR_USER_AUTH_TOKEN_URL).pipe(
                        HttpClientRequest.setUrlParam("identifier", snCreds.token),
                    );

                    const requestUrl = request.url // doesnt give full url with queryStringParameters

                    return yield* buildSolarNetworkHeaders(snCreds, requestUrl).pipe(
                        Effect.flatMap(({ headers, url }) => client.get(url, { headers })),
                        Effect.flatMap(HttpClientResponse.filterStatusOk),
                        Effect.flatMap(
                            HttpClientResponse.schemaBodyJson(AuthTokensResponseSchema),
                        ),
                        Effect.map((response) => response.data.results),
                        Effect.flatMap(A.head),
                    );
                }).pipe(Effect.withSpan("solar-network:getTokenDetails"));


Here im running into an issue where i cannot get the url of the composed request. I need the full url with params, but this only gives me the url without params. How can i get the whole thing? Btw i also tried something like

const fullUrl = HttpClientRequest.toUrl(request).pipe(
  Option.map((url) => url.toString()),
  Option.getOrElse(() => request.url),
);


This doesnt give the full request url either.
Was this page helpful?