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

Documentation mistake #1666

Closed
dob9601 opened this issue Oct 19, 2024 · 5 comments · Fixed by #1667
Closed

Documentation mistake #1666

dob9601 opened this issue Oct 19, 2024 · 5 comments · Fixed by #1667
Assignees
Labels
documentation Improvements or additions to documentation
Milestone

Comments

@dob9601
Copy link
Contributor

dob9601 commented Oct 19, 2024

Ran into an issue whereby my requests were missing a ? for any requests containing query parameters. I traced the issue back to this chunk of code I copied from the documentation, which is missing a question mark when constructing the URL. This issue is potentially responsible for: #482

`${baseURL}${url}` + new URLSearchParams(params),

What versions are you using?

Checked on master
Please execute npx envinfo --system --npmPackages orval,zod,axios,msw,swr,@tanstack/react-query,@tanstack/vue-query,react,vue and paste the results here.

@melloware
Copy link
Collaborator

Can you post your exact fix? missing question mark where?

@melloware melloware added the documentation Improvements or additions to documentation label Oct 19, 2024
@dob9601
Copy link
Contributor Author

dob9601 commented Oct 19, 2024

Replacing:

${baseURL}${url}

With:

${baseURL}${url}?

Solved the issue since URLSearchParams doesn't generate a leading question mark when stringified.

Note that this isn't necessarily the ideal solution since requests without query parameters will end up with a trailing question mark - ideally there should be a check beforehand to ensure there are query parameters.

Happy to create a PR if that would be easiest :)

@melloware
Copy link
Collaborator

please do! I will merge it

@melloware melloware added this to the 7.2.0 milestone Oct 19, 2024
@melloware
Copy link
Collaborator

Assigned it to you.

@dob9601
Copy link
Contributor Author

dob9601 commented Oct 19, 2024

See #1667

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

Successfully merging a pull request may close this issue.

2 participants