Skip to content

fix: sanitize utils and sanitize all response code and messages#358

Merged
pi0 merged 12 commits intomainfrom
feat/sanetize-utils
Mar 15, 2023
Merged

fix: sanitize utils and sanitize all response code and messages#358
pi0 merged 12 commits intomainfrom
feat/sanetize-utils

Conversation

@pi0
Copy link
Copy Markdown
Member

@pi0 pi0 commented Mar 15, 2023

Following up #357, this PR fixes all setters of statusCode and statusMessage with two new sanetizeStatusCode and sanetizeStatusMessage utils

@pi0 pi0 requested a review from danielroe March 15, 2023 17:32
Comment thread src/error.ts Outdated
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 15, 2023

Codecov Report

Merging #358 (a2676d0) into main (2594e54) will decrease coverage by 0.04%.
The diff coverage is 70.58%.

❗ Current head a2676d0 differs from pull request most recent head 9c60b9e. Consider uploading reports for the commit 9c60b9e to get more accurate results

@@            Coverage Diff             @@
##             main     #358      +/-   ##
==========================================
- Coverage   74.60%   74.57%   -0.04%     
==========================================
  Files          25       26       +1     
  Lines        2359     2407      +48     
  Branches      370      380      +10     
==========================================
+ Hits         1760     1795      +35     
- Misses        599      612      +13     
Impacted Files Coverage Δ
src/event/event.ts 44.18% <16.66%> (-1.60%) ⬇️
src/error.ts 75.60% <61.90%> (-0.23%) ⬇️
src/utils/sanitize.ts 73.91% <73.91%> (ø)
src/utils/response.ts 62.38% <90.90%> (+0.34%) ⬆️
src/utils/index.ts 100.00% <100.00%> (ø)
src/utils/proxy.ts 82.35% <100.00%> (+0.38%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Comment thread src/error.ts Outdated
Comment thread src/utils/sanetize.ts Outdated
@pi0 pi0 requested a review from danielroe March 15, 2023 17:44
@danielroe danielroe changed the title fix: sanetize utils and sanetize all response code and messages fix: sanitize utils and sanitize all response code and messages Mar 15, 2023
Comment thread src/error.ts Outdated
Co-authored-by: Daniel Roe <daniel@roe.dev>
Comment thread src/error.ts Outdated
pi0 and others added 3 commits March 15, 2023 23:14
Co-authored-by: Daniel Roe <daniel@roe.dev>
Comment thread src/error.ts
Comment on lines +101 to +108
// TODO: Always sanitize status message in the next major releases
const originalMessage = err.statusMessage;
const sanitizedMessage = sanitizeStatusMessage(err.statusMessage);
if (sanitizedMessage !== originalMessage) {
console.warn(
"[h3] Please prefer using `message` for longer error messages instead of `statusMessage`. In the future `statusMessage` will be sanitized by default."
);
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this looks great to me 👌

@pi0 pi0 merged commit e885dc1 into main Mar 15, 2023
@pi0 pi0 deleted the feat/sanetize-utils branch March 15, 2023 22:18
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