Skip to content

qs.stringify does not respect the addQueryPrefix param when the result of stringify is an empty string #418

@ehab-cl

Description

@ehab-cl

Hey, thank you for the amazing library.

The following will return an empty string which i think is unexpected
qs.stringify({}, { addQueryPrefix: true })
i would expect the previous to return "?"

The use case is for many navigating methods including the native replaceState in window.history they discard an empty string while "?" means to empty the url query params.

I have noticed that this change was introduced in this commit 229b0e9#diff-0b54a0fe4e28dd7c969fecd6711539ca19dcd5cc1e19a175193d805468d863caL208, previously it would work as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions