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

[Fix bug] Fix result.params always be null #19

Merged
merged 1 commit into from
Apr 14, 2023
Merged

Conversation

CW-B-W
Copy link
Contributor

@CW-B-W CW-B-W commented Apr 13, 2023

The length of URLSearchParams cannot be obtained with Object.keys(params).length, thus Line 32 was never be executed

if (result.url) {
let url = new URL(result.url);
result.url = url.origin + url.pathname;
let params = new URLSearchParams(url.search);
if(Object.keys(params).length) {
result.params = convertor.parseParamsField(params.toString());
}
}

Change it to

if(Array.from(params).length) {

works on my side

Ref: https://stackoverflow.com/questions/42156024/how-do-i-get-the-size-or-length-for-url-searchparams

@9bany
Copy link
Owner

9bany commented Apr 14, 2023

LGTM ! Thanks @CW-B-W

@9bany 9bany self-requested a review April 14, 2023 10:22
@9bany 9bany merged commit 67818b4 into 9bany:master Apr 14, 2023
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

Successfully merging this pull request may close these issues.

2 participants