fix: correct HTTP status check logic in auth#3984
fix: correct HTTP status check logic in auth#3984srivilliamsai wants to merge 4 commits intokeploy:mainfrom
Conversation
The condition 'StatusCode != 200 || StatusCode >= 300' incorrectly rejects valid 2xx success codes like 201 Created. Changed to use http package constants and proper range check: 'StatusCode < http.StatusOK || StatusCode >= http.StatusMultipleChoices' Signed-off-by: SRI VILLIAM SAI <srivilliamsai@gmail.com>
Code Review SummaryStatus: No Issues Found | Recommendation: Merge OverviewThis PR correctly fixes a logic bug in the HTTP status code validation. The original condition The new condition Additional improvements:
Files Reviewed (1 file)
Reviewed by claude-opus-4.5 · 67,015 tokens |
There was a problem hiding this comment.
Pull request overview
Fixes HTTP status validation in the GitHub authentication flow so that any 2xx success response is accepted (instead of rejecting all non-200 success codes).
Changes:
- Replace incorrect
!= 200 || >= 300status check with a proper 2xx range check usingnet/httpconstants.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Fixes incorrect HTTP status code validation in the authentication flow.
Problem
The condition
res.StatusCode != 200 || res.StatusCode >= 300has a logic error:!= 200>= 300The OR operator causes any non-200 success code (like 201 Created) to be incorrectly rejected.
Solution
Changed to proper range check using http package constants: