-
-
Notifications
You must be signed in to change notification settings - Fork 631
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
refactor(utils/basic-auth): Moved Internal function to utils #3359
Conversation
src/utils/basic-auth.ts
Outdated
const USER_PASS_REGEXP = /^([^:]*):(.*)$/ | ||
const utf8Decoder = new TextDecoder() | ||
|
||
export type Auth = (req: HonoRequest) => { username: string; password: string } | undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer making req
as Request
not HonoRequest
. The utility function should be more general. So, HonoRequest
that depends on Hono is not good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the review.
I have removed the dependency on HonoRequest.
989a0db
Hi @sugar-cat7 Thank you for the PR(this is your first PR for |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3359 +/- ##
==========================================
+ Coverage 95.76% 95.77% +0.01%
==========================================
Files 151 152 +1
Lines 9186 9187 +1
Branches 2708 2699 -9
==========================================
+ Hits 8797 8799 +2
+ Misses 389 388 -1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Thank you! I'm merging it. |
I have moved the functions used internally in the Basic Auth Middleware to the utils directory. Additionally, I have added tests.
For the background on this refactor, please refer to the following: honojs/middleware#676 (comment)
The author should do the following, if applicable
bun run format:fix && bun run lint:fix
to format the code