Closed amantinetti closed 4 days ago
The recent update introduces a new field, Next
, to the Config
struct in the Fiber New Relic middleware. This field is a function used to conditionally skip middleware execution based on custom logic. Corresponding changes have been made to the primary implementation and readme files, along with new test cases verifying the conditional execution logic.
File | Change Summary |
---|---|
fibernewrelic/README.md |
Updated the Config section to include the new Next field, describing its type, purpose, and default value. |
fibernewrelic/fiber.go |
Added the Next field to the Config struct and implemented conditional logic for skipping middleware execution if Next is provided and evaluates true. |
fibernewrelic/fiber_test.go |
Added new test cases to validate the conditional execution provided by the Next field in the Fiber New Relic middleware. |
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
Fiber sped through lines now quick,
With aNext
to pick or skip,
Routes and paths, it darted swift,
Middleware magic, code adrift.
Tests did prove, and changes sang,
🎉 In the realm where functions rang! 🚀
[!TIP]
AI model upgrade
## `gpt-4o` model for reviews and chat is now live OpenAI claims that this model is better at understanding and generating code than the previous models. Please join our [Discord Community](https://discord.com/invite/GsXnASn26c) to provide any feedback or to report any issues.
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
@amantinetti could you add a testcase for the usage of this function
@amantinetti could you add a testcase for the usage of this function
@ReneWerner87 Test cases are added :D
Add Next Function on config Next defines a function to skip newrelic middleware when returned true.
Summary by CodeRabbit
New Features
Next
function in the configuration to allow skipping middleware based on a custom condition.Bug Fixes
ErrorStatusCodeHandler
in the configuration to provide more flexibility in handling status codes.Tests
Next
function in the middleware configuration.