Repository navigation
Conversation
The Perfect-NIO example created and stored a new session, and ran the handler, for every OPTIONS preflight, since preflights carry no cookies. Answer them with an empty 204 at the top of loadSession instead, and say what a cross-origin app has to add. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
The Perfect-NIO example in the README has a gap: a browser's CORS preflight (
OPTIONS, sent without cookies) went throughloadSession, so each one created and stored a new session, ran the page handler and got aSet-Cookie.The example now answers
OPTIONSat the top ofloadSessionwith an empty204(throw TerminationType.criteriaFailed(.noContent)). A new paragraph explains why, and says that an app accepting cross-origin requests needs to answer preflights from acceptable origins withAccess-Control-*headers. The intro now says Perfect-NIO 0.2, which is the version the example was checked against.Checked: both README snippets, unchanged apart from imports, build with warnings as errors against Perfect-NIO 0.2.0 and this branch. In a running server with a counting driver:
200 visits: 1with a new cookie each time, and created 3 sessions.204with no cookie and create 0 sessions, andGETstill returns200with the session cookie.Docs only, so no release is needed.
🤖 Generated with Claude Code