[feature] fibernewrelic add skip middleware next function. - #1148
Conversation
WalkthroughThe recent update introduces a new field, Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant FiberApp
participant NewRelicMiddleware
participant NextHandler
Client->>FiberApp: Send Request
FiberApp->>NewRelicMiddleware: Pass to Middleware
NewRelicMiddleware->>NewRelicMiddleware: Check `cfg.Next()`
alt `cfg.Next()` is true
NewRelicMiddleware->>NextHandler: Skip Middleware
else `cfg.Next()` is false
NewRelicMiddleware->>NewRelicMiddleware: Continue Middleware
end
NewRelicMiddleware->>FiberApp: Pass to Next Middleware/Handler
FiberApp->>Client: Return Response
Poem
Tip AI model upgrade
|
There was a problem hiding this comment.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- fibernewrelic/README.md (1 hunks)
- fibernewrelic/fiber.go (3 hunks)
Additional context used
Markdownlint
fibernewrelic/README.md
42-42: Expected: 1; Actual: 2
Multiple consecutive blank lines(MD012, no-multiple-blanks)
Additional comments not posted (4)
fibernewrelic/README.md (1)
32-41: LGTM!The additions to the
Configsection are well-documented and align with the PR objectives.fibernewrelic/fiber.go (3)
28-30: LGTM!The addition of the
Nextproperty to theConfigstruct is clear and well-documented.
39-39: LGTM!The default value for the
Nextproperty inConfigDefaultis correctly set tonil.
73-76: LGTM!The conditional check for
cfg.Nextin theNewfunction is correctly implemented.
|
@amantinetti could you add a testcase for the usage of this function |
@ReneWerner87 Test cases are added :D |
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- fibernewrelic/fiber_test.go (1 hunks)
Additional comments not posted (2)
fibernewrelic/fiber_test.go (2)
276-306: Test case for skipping middleware execution looks good.The test case ensures that the New Relic middleware is skipped when the
Nextfunction returnstrue.
308-338: Test case for continuing middleware execution looks good.The test case ensures that the New Relic middleware continues execution when the
Nextfunction returnsfalse.
Add Next Function on config
Next defines a function to skip newrelic middleware when returned true.
Summary by CodeRabbit
New Features
Nextfunction in the configuration to allow skipping middleware based on a custom condition.Bug Fixes
ErrorStatusCodeHandlerin the configuration to provide more flexibility in handling status codes.Tests
Nextfunction in the middleware configuration.