-
-
Notifications
You must be signed in to change notification settings - Fork 386
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
Add unauthorised200 parameter to /user endpoint #1763
base: master
Are you sure you want to change the base?
Conversation
size-limit report 📦
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1763 +/- ##
==========================================
+ Coverage 61.47% 65.06% +3.59%
==========================================
Files 132 140 +8
Lines 2998 3521 +523
Branches 715 785 +70
==========================================
+ Hits 1843 2291 +448
- Misses 1151 1158 +7
- Partials 4 72 +68 ☔ View full report in Codecov by Sentry. |
6ad5bec
to
52a9ab7
Compare
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 don't think this is a proper solution
52a9ab7
to
e189877
Compare
Pull Request Test Coverage Report for Build 9060885089Details
💛 - Coveralls |
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'm interested in seeing a fix for #1188. Just a couple drive-by comments in case they can help move this forward.
@@ -291,10 +291,17 @@ func (s *Rest) routes() chi.Router { | |||
rauth.Use(middleware.Timeout(30 * time.Second)) | |||
rauth.Use(tollbooth_chi.LimitHandler(tollbooth.NewLimiter(10, nil))) | |||
rauth.Use(authMiddleware.Auth, matchSiteID, middleware.NoCache, logInfoWithBody) | |||
rauth.Get("/user", s.privRest.userInfoCtrl) |
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.
Could this line be moved into the open routes group of handlers above, rather than creating a new group for it?
user := rest.MustGetUserInfo(r) | ||
user, err := rest.GetUserInfo(r) | ||
if err != nil { | ||
if r.URL.Query().Get("unauthorised200") == "true" { |
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.
Is the unauthorised200 parameter necessary? It looks like the frontend code will already accept a 200 response with null
as the JSON response.
Please correct me if I'm wrong, I'm new here, but I think if null
can be returned here, it looks like no frontend changes would be needed.
This resolves #1188 without making extra HTTP calls by adding a new parameter to the /api/v1/user endpoint.
Continuation of accidentally closed #1752.