fix: stop request() from refusing an Endpoint with no Current login - #388
Merged
diegolmello merged 5 commits intoAug 24, 2026
Merged
Conversation
Restores the logged-out client's assertion that an Endpoint still reaches the REST client.
diegolmello
deleted the
diegolmello/fix-pre-login-rest-calls-throw-locally-because-r-2
branch
August 24, 2026 18:14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
Api.requestrefused everyEndpointcalled with noCurrent login, throwingrequires a logininside the SDK without any request reaching the server. This broke registration, password recovery and confirmation email for every new user.The
authflag never controlled the auth headers — those are attached bysetLoginfrom theCurrent login, independently of it. Its only effect was that guard, a client-side pre-flight duplicating a decision only the server can make, so it could only produce false negatives.authparameter fromrequest, the four verb wrappers (post,get,put,del), andIAPIRequest.info(), which passedthis.loggedIn().loggedIn()stays public and unchanged.login/logoutblock inlib/api/api.ts.Breaking for positional callers: dropping the third slot shifts every later positional argument. TypeScript consumers get a compile error, but an untyped
api.get('x', {}, true)would now bindtruetoignore. No caller in this repo still passes it.Steps to reproduce
Apiwith noLogin, socurrentLoginisnull.poston anEndpointthat needs no session, e.g.users.forgotPassword.requires a loginand theREST clientis never called. After: theEndpointand payload reach theREST client.Tests
Api with no Current login > sends the Endpoint to the REST client with no Current loginApi with no Current login > sends info() with the auth headers once a Current login is heldclient.logout > reports itself logged outclient.logout > still sends an Endpoint to the REST client