-
-
Notifications
You must be signed in to change notification settings - Fork 452
Open
Description
This is not a bug because the behavior is documented in the README:
Search parameters to include in the request URL. Setting this will override all existing search parameters in the input URL.
Nevertheless, I think this behavior is unintuitive. We are in the process of migrating a large codebase from axios -> ky and this difference is difficult to accommodate.
It would make more sense to me if the default behavior was to merge URLSearchParams specified in the input URL with anything specified in options.searchParams. It would be easy to reintroduce the current behavior with a beforeRequest hook that rewrites the request URL based on options.searchParams, if desired.
await ky.post('/example?foo=bar', {
searchParams: {
id: 'id'
}
});
// Expected: -> POST /example?foo=bar&id=id
// Actual: -> POST /example?id=idReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels