Support usage of URLSearchParams as a value for query / params
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.4k
- Forks
- 195
- PR merge metrics
- No merged PRs in 30d
Description
Describe the feature
I naively used URLSearchParams in order to prepare the parameters I want to send along the request, however those are not read if I use an interceptor later on.
const $fetch = ofetch.create({
baseURL: this.baseUrl,
onRequest: ({ options }) => {
options.query ||= new URLSearchParams();
options.query.set('token', this.token);
}
});
const query = new URLSearchParams({
title,
});
$fetch(url, { query })
Is it something unwanted, or is a contribution welcome for this one ?
Additional information
- Would you be willing to help implement this feature?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named in the issue. Start by tracing how query or params values are processed before and after the request interceptor, then reproduce the provided URLSearchParams example. Done means URLSearchParams values supplied directly and created in an interceptor are included in the outgoing request.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100