Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong fetch URL with expand query param #7

Open
aravindballa opened this issue Nov 26, 2024 · 2 comments
Open

Wrong fetch URL with expand query param #7

aravindballa opened this issue Nov 26, 2024 · 2 comments

Comments

@aravindballa
Copy link

When there is expand query parameter set, it doesn't stringify the fetch URL properly.

For example, when I have { expand: ['free_web_content'] }

Result: https://api.beehiiv.com/v2/publications/:publicationId/posts/:postId?expand=%5B%22free_web_content%22%5D
Expected: https://api.beehiiv.com/v2/publications/:publicationId/posts/:postId?expand=free_web_content

It seems that we use qs package. The issue is it doesn't process nested keys, which is documented on the site.

(this cannot convert nested objects, such as a={b:1},{c:d})
https://github.com/ljharb/qs?tab=readme-ov-file#parsing-arrays

(The documentation refers to parsing, but I assume that's the case of stringify-ing as well)

@niklas-wortmann
Copy link

Hey there, Is there an ETA for this? Otherwise I'd ship a astro beehiive content loader with a modified copy of the generated code for the time being?

@bcornick
Copy link

Does this mean that no queries using { expand: [] } currently work with the SDK?

I'm trying to fetch subscriber count from my publication and can't get the stats object to show up in the response through the SDK, but works fine through Postman.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants