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

feat: decodeQueryValue and decode query params with support for space #11

Merged
merged 4 commits into from
Feb 2, 2021

Conversation

danielroe
Copy link
Member

No description provided.

danielroe added a commit to nuxt/nuxt that referenced this pull request Feb 2, 2021
danielroe added a commit to nuxt/nuxt that referenced this pull request Feb 2, 2021
@codecov-io
Copy link

Codecov Report

Merging #11 (58190ea) into main (5c6b320) will increase coverage by 0.48%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #11      +/-   ##
==========================================
+ Coverage   84.40%   84.89%   +0.48%     
==========================================
  Files           7        7              
  Lines         186      192       +6     
  Branches       51       51              
==========================================
+ Hits          157      163       +6     
  Misses         29       29              
Impacted Files Coverage Δ
src/encoding.ts 94.87% <100.00%> (+0.93%) ⬆️
src/query.ts 95.83% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5c6b320...58190ea. Read the comment docs.

src/encoding.ts Outdated Show resolved Hide resolved
@pi0 pi0 changed the title fix: decode query params with support for space feat: decodeQueryValue and decode query params with support for space Feb 2, 2021
@pi0 pi0 merged commit 44a0538 into unjs:main Feb 2, 2021
@pi0
Copy link
Member

pi0 commented Feb 2, 2021

Released as 0.6.0

@danielroe danielroe deleted the decode-query-params branch February 2, 2021 22:36
@@ -12,7 +17,7 @@ export function parseQuery (paramsStr: string = ''): QueryObject {
const s = (param.match(/([^=]+)=?(.*)/) || [])
if (s.length < 2) { continue }
const key = decode(s[1])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if key is having space? The space is replaced with + sign while encoding but on decode it doesn't replace back to space.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind to make a PR adding test case?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pi0 Raised PR #150

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.

None yet

4 participants