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: handle missing route options #236

Merged
merged 6 commits into from
Sep 24, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,17 @@
return false
}

function getReqConfig(req) {

Check failure on line 223 in index.js

View workflow job for this annotation

GitHub Actions / test / Lint Code

Missing space before function parentheses
jean-michelet marked this conversation as resolved.
Show resolved Hide resolved
if (req.routeOptions && req.routeOptions.config) {
jean-michelet marked this conversation as resolved.
Show resolved Hide resolved
return req.routeOptions.config
}

return req.context.config
}

function onRequest (req, reply, next) {
const _pressureHandler = req.routeOptions.config.pressureHandler || pressureHandler
const config = getReqConfig(req)
const _pressureHandler = config.pressureHandler || pressureHandler
if (checkMaxEventLoopDelay && eventLoopDelay > maxEventLoopDelay) {
handlePressure(_pressureHandler, req, reply, next, TYPE_EVENT_LOOP_DELAY, eventLoopDelay)
return
Expand Down
Loading