Repository navigation
Conversation
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.
Summary
publicMethodshad"post"in lowercase, so it never matched the method on incoming requests. It is now"POST". The doc comment now says which methods bypass auth.User.userNametousernameso it matches the routes and tests.badRequestimport.RangeErrorif page or size is not a positive integer."types": ["bun-types"], which was already installed. This fixes thebun:testandprocesstype errors.// BUG:comments.All tests pass (22 of 22) and
tsc --noEmitreports no errors. The change was reviewed, and re-reviewed after the follow-up commits.Before this change, POST requests needed a token only because the lowercase entry never matched. This fix follows
auth.test.tsand the documented policy, which say POST is public. As a result, POST/usersand/postsnow work without a token. Anyone can create users, or create posts with anyauthorId. Test files couldn't be changed for this task, so the behaviour follows the test. Please confirm unauthenticated writes are intended. If not, remove POST frompublicMethodsand update the test to expect 401.Assumptions and follow-ups
paginaterejecting invalid input (page or size that is not a positive integer) goes beyond what the tests ask for. It's there to stop wrong results such as a negative slice orInfinitypages. No route calls it yet.API_TOKENfalls back to"test-token"when unset, the token comparison isn't constant-time, OPTIONS and HEAD requests need auth, andbun-typesis set tolatestrather than a pinned version.