Bewinxed / svetch

Auto-Generated typesafe client & API docs generator for your Serverless Application (Svelte First)
https://svetch-dev.vercel.app/
67 stars 0 forks source link

Query param `?` separator not inserted in URL #5

Closed jessecoleman closed 1 month ago

jessecoleman commented 1 month ago

Hi, just started playing around with this library, no configuration yet. But right off the bat I noticed that query params are not being separated from the URL path by a ?

Example:

        const query = await svetch.get('/api/puzzles/daily/month', {
          query: { date: dateToString(d), mode: $mode }
        })

Result: image

This can be fixed by adding a question mark to the first param of svetch.get but that breaks the types. Thanks for the cool library!

jessecoleman commented 1 month ago

https://github.com/Bewinxed/svetch/blob/49746008fff195118927df4322aeb868c39cdc4d/src/assets/client.ts#L123

I think on this line, it needs to be

        const url = `${baseUrl ?? ""}${updatedEndpoint}${query_params.size ? '?' : ''}${query_params.toString()}`;

Or something to that effect.

Bewinxed commented 1 month ago

Thank you, fixed in 2.1.45

npx ***@***.***

On Sat, Sep 7, 2024 at 7:44 AM Cole Chamberlin @.***> wrote:

https://github.com/Bewinxed/svetch/blob/49746008fff195118927df4322aeb868c39cdc4d/src/assets/client.ts#L123

I think on this line, it needs to be

  const url = `${baseUrl ?? ""}${updatedEndpoint}${query_params.size ? '?' : ''}${query_params.toString()}`;

Or something to that effect.

— Reply to this email directly, view it on GitHub https://github.com/Bewinxed/svetch/issues/5#issuecomment-2335040077, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACFY5BIBVC3KOKKN4G46THTZVKAEFAVCNFSM6AAAAABNZVU6H2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMZVGA2DAMBXG4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

jessecoleman commented 1 month ago

Thanks, seems to be working now!