Skip to content
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

fix(next): Respond in appropriate way inside withArcjet #53

Merged
merged 3 commits into from
Dec 14, 2023

Conversation

blaine-arcjet
Copy link
Contributor

Fixes #52

This adds a utility function to our SDK that will check the 2nd argument to a wrapped handler. If it has the status and json functions, we will use it like a NextApiResponse. If it does not, we will return a NextResponse.

I've added an example of a pages route that leverages the helper function.

Copy link
Contributor

@davidmytton davidmytton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added and tested with an edge example, too. Looks good!

@blaine-arcjet blaine-arcjet merged commit f822c9f into main Dec 14, 2023
7 checks passed
@blaine-arcjet blaine-arcjet deleted the phated/wrap-arcjet-pages branch December 14, 2023 17:24
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.

withArcjet helper doesn't work in Next.js Pages Router
2 participants