Skip to content

Pass the request to the authorize callback - #6

Merged
arnelirobles merged 2 commits into
mainfrom
fix/3-authorize-request
Nov 12, 2026
Merged

arnelirobles merged 2 commits into
mainfrom
fix/3-authorize-request

Conversation

@arnelirobles

@arnelirobles arnelirobles commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

The authorize callback now gets the incoming request as a second argument in both the Fetch and Express handlers, so it can read headers, cookies or the IP. Callbacks that take only the body keep working. The README shows the Fetch and Express header reads, and says not to read the request body again (it is already parsed). A compile check against @types/express now runs in CI.

Closes #3

- test: test/authorize.test.mjs "the Fetch handler passes the Request to authorize"
  breaks: src/server/handler.ts "opts.authorize(body, request)"
- test: test/authorize.test.mjs "the Express handler passes req to authorize"
  breaks: src/server/handler.ts "opts.authorize(body, req)"
- test: test/types/express-consumer.ts
  breaks: src/server/handler.ts "request?: any"
- test: test/types/express-consumer.ts
  breaks: src/server/handler.ts "req: { body?: unknown }"
- untested: README.md #1
  why: docs

@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 29 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8b09c24b-8a95-47d4-8d47-a57f79fc57af
Commits

Reviewing files that changed from the base of the PR and between c2f85bd and b602922.

Files ignored due to path filters: 1

  • package-lock.json is excluded by !**/package-lock.json
Files selected for processing: 7

  • .github/workflows/ci.yml
  • README.md
  • package.json
  • src/server/handler.ts
  • test/authorize.test.mjs
  • test/types/express-consumer.ts
  • test/types/tsconfig.json
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@arnelirobles
arnelirobles marked this pull request as ready for review November 12, 2026 13:16
@arnelirobles
arnelirobles merged commit d2c3f83 into main Nov 12, 2026
2 checks passed
@arnelirobles
arnelirobles deleted the fix/3-authorize-request branch November 12, 2026 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

authorize callback never receives the request, so it cannot do auth

1 participant