-
Notifications
You must be signed in to change notification settings - Fork 119
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: HCaptcha Middleware #1071
Conversation
WalkthroughThe recent changes introduce a robust Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 2
res, err := app.Test(req, -1) | ||
defer res.Body.Close() |
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.
Ensure defer res.Body.Close()
is called after checking for an error from app.Test(req, -1)
to avoid potential nil pointer dereference.
- defer res.Body.Close()
res, err := app.Test(req, -1)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer res.Body.Close()
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
res, err := app.Test(req, -1) | |
defer res.Body.Close() | |
res, err := app.Test(req, -1) | |
if err != nil { | |
t.Fatal(err) | |
} | |
defer res.Body.Close() |
hcaptcha/hcaptcha.go
Outdated
req.Header.SetMethod("POST") | ||
req.Header.SetContentType("application/x-www-form-urlencoded; charset=UTF-8") | ||
req.Header.Set("Accept", "application/json") | ||
req.SetRequestURI(c.Host()) |
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.
Set the request URI to h.SiteVerifyURL
instead of c.Host()
for the HCaptcha API call.
- req.SetRequestURI(c.Host())
+ req.SetRequestURI(h.SiteVerifyURL)
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
req.SetRequestURI(c.Host()) | |
req.SetRequestURI(h.SiteVerifyURL) |
|
I added it to the root README and I created a README file for it, I tried to enable dependabot, but I don't know how to excatly enable workflows for this pull request. I never did it before, that's new for me :// |
@bndrmrtn Copy one of the test workflows for the other contrib middlewares, and adapt it to this one. |
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.
Actionable comments posted: 1
I think I did it, right? 🤔 |
will check it tomorrow |
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.
- add release drafter workflow and config
- add section to the dependabot.yml
pls add a section like this contrib/.github/dependabot.yml Lines 101 to 106 in f6a1c31
and copy the release drafter yaml´s |
fix dependabot.yml
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.
Actionable comments posted: 1
Hcaptcha middleware
@bndrmrtn pls don't create useless pull requests |
yeah, really sorry 😅 |
fixed with f5b94a8 |
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.
Actionable comments posted: 4
@gaby @sixcolors @efectn can you check |
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.
Actionable comments posted: 5
Thanks! 🤩 |
Summary by CodeRabbit
New Features
Documentation
Tests
Chores