Skip to content

Conversation

@ReneWerner87
Copy link
Member

@ReneWerner87 ReneWerner87 commented Sep 1, 2025

Summary

  • bump module paths to contrib v3 layout
  • update docs, examples and signatures to use fiber.Ctx values
  • adjust tests for new content-type defaults

Testing

  • go fmt ./...
  • go vet ./...
  • go test ./...
  • golangci-lint run (warns Go 1.24 < required 1.25)
    • casbin, circuitbreaker, fiberi18n, fibersentry, hcaptcha, jwt, loadshed, monitor, opafiber, paseto, socketio, swagger : ✅
    • fgprof, fibernewrelic, fiberzap, fiberzerolog, otelfiber, testcontainers, websocket : ❌ (tests/vet failures)

https://chatgpt.com/codex/tasks/task_e_68b546e64d188326b452c1f84c8615bc

Summary by CodeRabbit

  • Documentation

    • Updated READMEs and examples for Fiber v3; added v3 support notes and new module paths; examples use fiber.Ctx by value.
  • Refactor

    • Standardized public callbacks to accept fiber.Ctx by value across many middlewares.
    • Removed one deprecated option from an observability package.
    • Updated a socket middleware to return a value-based handler.
  • Tests

    • Updated test imports, adjusted Content-Type expectations to include charset, and simplified some test timeouts.
  • Chores

    • Migrated example and test import paths to v3 module layout.

@ReneWerner87 ReneWerner87 requested a review from a team as a code owner September 1, 2025 07:44
@ReneWerner87 ReneWerner87 requested review from gaby and removed request for a team September 1, 2025 07:44
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 1, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • go.work is excluded by !**/*.work, !**/*.work

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Project-wide Fiber v3 migration: docs and examples updated to v3 module paths; many README/API samples change callbacks and handlers to accept fiber.Ctx by value instead of *fiber.Ctx; a few tests adjusted to use Fiber MIME constants; minimal code edits where call sites passed ctx by pointer (e.g., monitor).

Changes

Cohort / File(s) Summary of changes
Casbin docs (v3 path, value Ctx)
casbin/README.md
Install/import updated to github.com/gofiber/contrib/v3/casbin/v1; Config.Lookup/Unauthorized/Forbidden documented as func(fiber.Ctx) ...; examples use fiber.Ctx by value.
Circuitbreaker docs & test
circuitbreaker/README.md, circuitbreaker/circuitbreaker_test.go
README uses .../v3/circuitbreaker/v1; callbacks OnOpen/OnClose/OnHalfOpen shown as func(fiber.Ctx); test asserts Content-Type via fiber.MIMEApplicationJSONCharsetUTF8.
fgprof docs & test
fgprof/README.md, fgprof/fgprof_test.go
README import to .../v3/fgprof/v1; Next shown as func(fiber.Ctx) bool; test uses ?seconds=0 and default timeout.
fiberi18n docs & example
fiberi18n/README.md, fiberi18n/example/main.go
README and example import github.com/gofiber/contrib/v3/fiberi18n/v1; signatures (Localize, MustLocalize, LangHandler, Next) use fiber.Ctx by value; example handlers updated.
fibernewrelic docs
fibernewrelic/README.md
README updated to v3 path; ErrorStatusCodeHandler and Next documented to accept fiber.Ctx value; examples updated.
fibersentry docs
fibersentry/README.md
README imports updated to v3 path; BeforeSend and handler examples use fiber.Ctx value in assertions and callbacks.
fiberzap docs & config
fiberzap/README.md, fiberzap/config.go
README import updated to v3; Config.Next and GetResBody use fiber.Ctx by value; docs/examples updated.
fiberzerolog docs
fiberzerolog/README.md
README import updated to .../v3/fiberzerolog/v1; Next, GetLogger, GetResBody documented to accept fiber.Ctx value; examples updated.
hcaptcha docs
hcaptcha/README.md
Added Fiber v3 note and install/import updated to .../v3/hcaptcha/v1; docs-only changes.
JWT docs & test
jwt/README.md, jwt/jwt_test.go
README and test import path updated to .../v3/jwt/v1; alias unchanged; no API logic changes.
LoadShed docs & test
loadshed/README.md, loadshed/loadshed_test.go
README import to .../v3/loadshed/v1; Config.Next and OnShed documented as value fiber.Ctx; test asserts JSON Content-Type via Fiber constant.
Monitor docs, code, tests
monitor/README.md, monitor/monitor.go, monitor/monitor_test.go
README updated to v3; Config.Next signature changed to func(fiber.Ctx) bool; code updated to call cfg.Next(c) (value) instead of cfg.Next(&c); tests expect JSON Content-Type with charset constant.
opafiber docs
opafiber/README.md
README import to v3; InputCreationFunc and examples use func(c fiber.Ctx) ...; examples updated.
otelfiber docs, code, example, tests
otelfiber/README.md, otelfiber/doc.go, otelfiber/example/server.go, otelfiber/fiber.go, otelfiber/otelfiber_test/fiber_test.go
Module path bumped to v3; instrumentationName and internal imports updated to v3 path; docs reflect value fiber.Ctx in options; WithServerName removal documented; example and tests updated.
Paseto docs
paseto/README.md
README import to .../v3/paseto/v1; Config.Next documented as func(Ctx) bool; examples updated.
Socket.IO docs, code, tests
socketio/README.md, socketio/socketio.go, socketio/socketio_test.go
README and examples use v3 paths; public New now shown returning func(fiber.Ctx) error; websocket import switched to github.com/gofiber/contrib/v3/websocket/v1 in code/tests.
Swagger docs
swagger/README.md
README import changed to v3; Config.Next documented to accept fiber.Ctx value.
Testcontainers docs & tests
testcontainers/README.md, testcontainers/examples_test.go, testcontainers/testcontainers_test.go
README and tests updated to .../v3/testcontainers/v1; examples/tests import path change only.
Websocket docs
websocket/README.md
README notes Fiber v3 and updates install/import to .../v3/websocket/v1; docs-only changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Client
  participant App as Fiber App
  participant Middleware as monitor.Middleware
  participant Handler as Next Handler

  Client->>App: HTTP Request
  App->>Middleware: call middleware with ctx (value)
  Note right of Middleware: cfg.Next now invoked as cfg.Next(c) (value)
  alt cfg.Next(c) == true
    Middleware->>Handler: skip middleware, call next
    Handler-->>Client: response
  else
    Middleware->>Middleware: collect metrics / render output
    Middleware-->>Client: metrics response (JSON)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

v3, 🧹 Updates, 📒 Documentation

Suggested reviewers

  • gaby
  • sixcolors
  • efectn

Poem

I hop through modules, changing names with glee,
From stars to v3, the paths align for me.
Ctx by value, handlers light and spry,
Tests hum UTF‑8, headers waving hi.
A rabbit’s nod — tidy docs, new trails to try 🐇✨

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/2025-09-01-07-44-41

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @ReneWerner87, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on a significant upgrade across multiple gofiber/contrib middlewares to ensure full compatibility and adherence to the Fiber v3 ecosystem. The changes primarily involve updating module import paths, standardizing the use of fiber.Ctx in function signatures and examples, and adjusting tests to reflect these foundational shifts. This effort streamlines the integration of these middlewares with Fiber v3 and prepares them for future development.

Highlights

  • Module Path Updates: All affected Go modules have had their import paths updated to align with the new contrib/v3 layout, ensuring compatibility with Fiber v3.
  • Fiber Context Type Change: Function signatures and examples across various middlewares have been updated to use fiber.Ctx instead of *fiber.Ctx, reflecting the latest Fiber v3 API.
  • Test Adjustments: Tests have been modified to accommodate new content-type defaults and other API changes in Fiber v3, with some modules passing and others still requiring attention.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

Codex Review: Here are some suggestions.

Reply with @codex fix comments to fix any unresolved comments.

About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".

Comment on lines 54 to 58
app.Use(New())

// Default fgprof interval is 30 seconds
resp, err := app.Test(httptest.NewRequest("GET", "/debug/fgprof?seconds=1", nil), fiber.TestConfig{Timeout: 1500})
resp, err := app.Test(httptest.NewRequest("GET", "/debug/fgprof?seconds=0", nil))
assert.Equal(t, nil, err)

Choose a reason for hiding this comment

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

[P1] Restore fgprof test duration to avoid timeouts

Changing Test_Fgprof_Path to call /debug/fgprof?seconds=0 while also dropping the fiber.TestConfig{Timeout: 1500} causes the handler to default back to a 30 s profiling interval (as noted in the comment) but the test still uses the default 1 s timeout in app.Test. The request will now hit a context deadline before fgprof writes a response, so the test fails and no longer verifies the middleware. Keep the shorter profiling interval or extend the test timeout.

Useful? React with 👍 / 👎.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly updates module paths, import statements, and function signatures across multiple modules to align with the Fiber v3 release. The changes are largely mechanical and consistent. However, I've identified an issue in the documentation for the fiberzap middleware where an example uses a deprecated function, c.SetUserContext, which has been removed in Fiber v3. This makes the example non-functional and is likely related to the test failures mentioned in the pull request description for modules that rely on context propagation.

Comment on lines +111 to 115
app.Use(func(c fiber.Ctx) error {
ctx := context.WithValue(c.UserContext(), "request_id", "123")
c.SetUserContext(ctx)
return c.Next()
})
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The example for NewLogger is no longer valid for Fiber v3. The method c.SetUserContext(ctx) was removed in Fiber v3, so this code will not compile.

The context propagation pattern has changed significantly. You might need to use c.Locals() to pass request-scoped values and adapt the logger to retrieve values from there, as it's not possible to replace the context.Context on fiber.Ctx anymore.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 15

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (17)
jwt/README.md (1)

39-46: Config table types are outdated vs. current API.

Docs still show interface{} for SigningKey/SigningKeys, but code/examples/tests use a concrete jwtware.SigningKey (with fields like JWTAlg/Key). Update to prevent user confusion.

Apply:

-| SigningKey     | `interface{}`                   | Signing key to validate token. Used as fallback if SigningKeys has length 0.                                                                            | `nil`                        |
-| SigningKeys    | `map[string]interface{}`        | Map of signing keys to validate token with kid field usage.                                                                                             | `nil`                        |
+| SigningKey     | `jwtware.SigningKey`            | Signing key (algorithm + key). Used as fallback if SigningKeys has length 0.                                                                            | `nil`                        |
+| SigningKeys    | `map[string]jwtware.SigningKey` | Map of signing keys (per kid via `kid`).                                                                                                                | `nil`                        |
paseto/README.md (2)

168-176: Missing Fiber import in “SymmetricKey + Custom Validator” example.

The snippet uses fiber.New and fiber.Ctx but doesn’t import fiber/v3.

Apply this diff:

 import (
 	"encoding/json"
 	"time"
 
 	"github.com/o1egl/paseto"
+	"github.com/gofiber/fiber/v3"
 
 	pasetoware "github.com/gofiber/contrib/v3/paseto/v2"
 )

57-59: Typo and grammar: “paseware.Config” → “pasetoware.Config”; improve phrasing.

User-facing docs should avoid typos.

Apply this diff:

-In case you want to use your own data structure, is needed to provide the `Validate` function in `paseware.Config`, that
-will return the data stored in the token, and a error.
+If you want to use your own data structure, you need to provide the `Validate` function in `pasetoware.Config`, which
+returns the data stored in the token and an error.
fibernewrelic/README.md (1)

96-103: Fix README example: pass context.Context to newrelic.FromContext.

newrelic.FromContext expects context.Context. With Fiber v3, obtain it via ctx.Context(). Current snippet won’t compile as written.

-	app.Get("/foo", func(ctx fiber.Ctx) error {
-		txn := newrelic.FromContext(ctx)
-		segment := txn.StartSegment("foo segment")
-		defer segment.End()
+	app.Get("/foo", func(ctx fiber.Ctx) error {
+		txn := newrelic.FromContext(ctx.Context())
+		segment := txn.StartSegment("foo segment")
+		defer segment.End()
fgprof/fgprof_test.go (1)

72-80: Use time.Duration for TestConfig.Timeout; 1500 is nanoseconds, causing timeouts

In v3, TestConfig.Timeout is a time.Duration. 1500 is 1.5µs, which explains “test: got empty response” and the downstream NPE. Use seconds.

-	resp, err := app.Test(httptest.NewRequest("GET", "/prefix/debug/fgprof?seconds=1", nil), fiber.TestConfig{Timeout: 1500})
+	resp, err := app.Test(
+		httptest.NewRequest("GET", "/prefix/debug/fgprof?seconds=1", nil),
+		fiber.TestConfig{Timeout: 2 * time.Second},
+	)
 	assert.Equal(t, nil, err)
 	assert.Equal(t, 404, resp.StatusCode)
 	// Fgprof prefix path
-	resp, err = app.Test(httptest.NewRequest("GET", "/test/debug/fgprof?seconds=1", nil), fiber.TestConfig{Timeout: 1500})
+	resp, err = app.Test(
+		httptest.NewRequest("GET", "/test/debug/fgprof?seconds=1", nil),
+		fiber.TestConfig{Timeout: 2 * time.Second},
+	)
 	assert.Equal(t, nil, err)
 	assert.Equal(t, 200, resp.StatusCode)
otelfiber/example/server.go (1)

47-51: Fix compile-time mismatch: pass context.Context and correct JSON keys

  • getUser expects context.Context, but c is fiber.Ctx. Use c.Context() (v3 renamed UserContext() to Context()).
  • In fiber.Map, "name" must be a string key, not the name variable.
-	app.Get("/users/:id", func(c fiber.Ctx) error {
-		id := c.Params("id")
-		name := getUser(c, id)
-		return c.JSON(fiber.Map{"id": id, name: name})
-	})
+	app.Get("/users/:id", func(c fiber.Ctx) error {
+		id := c.Params("id")
+		name := getUser(c.Context(), id)
+		return c.JSON(fiber.Map{"id": id, "name": name})
+	})
otelfiber/fiber.go (1)

175-179: Use the span context for header injection (fix propagation).

Inject should use the active span context (ctx), not c. Otherwise outbound headers may miss tracing context.

-        //Propagate tracing context as headers in outbound response
-        tracingHeaders := make(propagation.HeaderCarrier)
-        cfg.Propagators.Inject(c, tracingHeaders)
+        // Propagate tracing context as headers in outbound response
+        tracingHeaders := make(propagation.HeaderCarrier)
+        cfg.Propagators.Inject(ctx, tracingHeaders)
         for _, headerKey := range tracingHeaders.Keys() {
             c.Set(headerKey, tracingHeaders.Get(headerKey))
         }
otelfiber/otelfiber_test/fiber_test.go (5)

3-21: Add time import for correct Timeout usage.

 import (
 	"context"
 	"errors"
 	"fmt"
 	"net/http"
 	"net/http/httptest"
 	"testing"
+	"time"

424-427: Use proper Timeout and check error in TestCustomAttributes.

-	resp, _ := app.Test(httptest.NewRequest("GET", "/user/123?foo=bar", nil), fiber.TestConfig{Timeout: 3000})
+	resp, err := app.Test(httptest.NewRequest("GET", "/user/123?foo=bar", nil), fiber.TestConfig{Timeout: 3 * time.Second})
+	require.NoError(t, err)

508-513: Use proper Timeout and check error in TestOutboundTracingPropagation.

-	resp, _ := app.Test(httptest.NewRequest("GET", "/foo", nil), fiber.TestConfig{Timeout: 3000})
+	resp, err := app.Test(httptest.NewRequest("GET", "/foo", nil), fiber.TestConfig{Timeout: 3 * time.Second})
+	require.NoError(t, err)

538-543: Use proper Timeout and check error in TestOutboundTracingPropagationWithInboundContext.

-	resp, _ := app.Test(req, fiber.TestConfig{Timeout: 3000})
+	resp, err := app.Test(req, fiber.TestConfig{Timeout: 3 * time.Second})
+	require.NoError(t, err)

101-107: Convert all app.Test calls to use time.Second and check errors
There are four occurrences in otelfiber/otelfiber_test/fiber_test.go (lines 102, 424, 508, 538) where Timeout: 3000 (3µs) is used and the error is discarded. Replace each with:

- resp, _ := app.Test(..., fiber.TestConfig{Timeout: 3000})
+ resp, err := app.Test(..., fiber.TestConfig{Timeout: 3 * time.Second})
+ require.NoError(t, err)

This prevents nil‐response panics due to microsecond timeouts.

monitor/README.md (1)

36-41: Fix typos in table (user-facing docs).

  • “montioring” → “monitoring”
  • “specilt” → “special”
-| APIOnly    | `bool`                    | Whether the service should expose only the montioring API.                           | `false`                                                                     |
+| APIOnly    | `bool`                    | Whether the service should expose only the monitoring API.                           | `false`                                                                     |
-| FontURL    | `string`                  | FontURL for specilt font resource path or URL. also you can use relative path.       | `https://fonts.googleapis.com/css2?family=Roboto:wght@400;900&display=swap` |
+| FontURL    | `string`                  | FontURL for special font resource path or URL. You can also use a relative path.     | `https://fonts.googleapis.com/css2?family=Roboto:wght@400;900&display=swap` |
-| ChartJsURL | `string`                  | ChartJsURL for specilt chartjs library, path or URL, also you can use relative path. | `https://cdn.jsdelivr.net/npm/[email protected]/dist/Chart.bundle.min.js`        |
+| ChartJsURL | `string`                  | ChartJsURL for special Chart.js library, path or URL; you can also use a relative path. | `https://cdn.jsdelivr.net/npm/[email protected]/dist/Chart.bundle.min.js`     |
fibersentry/README.md (1)

116-120: Update type assertion to pointer
The context stores a *fiber.Ctx (pointer), so the assertion in README.md must be:

if c, ok := hint.Context.Value(sentry.RequestContextKey).(*fiber.Ctx); ok {
    fmt.Println(c.Hostname())
}
circuitbreaker/README.md (1)

173-181: Fix external API example (fiber.Get doesn’t exist)

Use net/http (and io) for the outbound call; current snippet won’t compile.

-app.Get("/external-api", circuitbreaker.Middleware(cb), func(c fiber.Ctx) error {
-	// Simulating an external API call
-	resp, err := fiber.Get("https://example.com/api")
-	if err != nil {
-		return fiber.NewError(fiber.StatusInternalServerError, "External API failed")
-	}
-	return c.SendString(resp.Body())
-})
+app.Get("/external-api", circuitbreaker.Middleware(cb), func(c fiber.Ctx) error {
+	// Simulating an external API call
+	resp, err := http.Get("https://example.com/api")
+	if err != nil {
+		return c.Status(fiber.StatusBadGateway).SendString("External API failed")
+	}
+	defer resp.Body.Close()
+	body, _ := io.ReadAll(resp.Body)
+	return c.Send(body)
+})

Also add the imports to the example’s import block:

+	"io"
+	"net/http"
loadshed/README.md (1)

146-150: Fix units in rejectionProbability formula (mixes fraction vs percent).

Thresholds are documented as fractions (0.0–1.0), but the formula subtracts LowerThreshold*100. Use consistent units.

-    rejectionProbability := (cpuUsage - LowerThreshold*100) / (UpperThreshold - LowerThreshold)
+    // If cpuUsage is a fraction in [0,1]:
+    rejectionProbability := (cpuUsage - LowerThreshold) / (UpperThreshold - LowerThreshold)
+    // If cpuUsage is a percent in [0,100], make thresholds percents too:
+    // rejectionProbability := (cpuUsage - LowerThresholdPct) / (UpperThresholdPct - LowerThresholdPct)
otelfiber/README.md (1)

96-100: Broken Go map literal in example.

Key must be a string: use "name": name.

-    return c.JSON(fiber.Map{"id": id, name: name})
+    return c.JSON(fiber.Map{"id": id, "name": name})
🧹 Nitpick comments (34)
jwt/README.md (1)

24-28: Optional: Add a brief “Migration to contrib v3” note above Install.

Helps users upgrading from github.com/gofiber/contrib/jwt understand the new contrib/v3/jwt/v2 path and fiber.Ctx value handlers.

Example:

  • Old: github.com/gofiber/contrib/jwt
  • New: github.com/gofiber/contrib/v3/jwt/v2
  • Handlers now take fiber.Ctx (value) instead of *fiber.Ctx.
fiberzerolog/README.md (1)

19-23: Install instructions: align zerolog module with example imports

The example uses github.com/rs/zerolog, but the install lists /log. Update to prevent confusion.

 go get -u github.com/gofiber/fiber/v3
 go get -u github.com/gofiber/contrib/v3/fiberzerolog/v2
-go get -u github.com/rs/zerolog/log
+go get -u github.com/rs/zerolog
fiberzap/README.md (3)

35-35: Clarify type to include package and tighten wording.

Use fiber.Ctx explicitly for consistency with v3 docs and examples.

-| Next       | `func(Ctx) bool`          | Define a function to skip this middleware when returned true                                                                                                                   | `nil`                                                                       |
+| Next       | `func(c fiber.Ctx) bool`  | Skip this middleware when the function returns true                                                                                                                            | `nil`                                                                       |

37-37: Grammar: improve “Fields” description.

-| Fields     | `[]string`                 | Add fields what you want see.                                                                                                                                                  | `[]string{"latency", "status", "method", "url"}`                            |
+| Fields     | `[]string`                 | Select which fields to log.                                                                                                                                                     | `[]string{"latency", "status", "method", "url"}`                            |

116-119: Match context API usage in example and remove tabs.

Align WithContext(...) call with the verified v3 getter and fix tabs.

-    app.Get("/", func(c fiber.Ctx) error {
-        log.WithContext(c.UserContext()).Info("Hello, World!")
-        return c.SendString("Hello, World!")
-    })
+    app.Get("/", func(c fiber.Ctx) error {
+        log.WithContext(c.Context()).Info("Hello, World!")
+        return c.SendString("Hello, World!")
+    })
paseto/README.md (2)

289-318: Fix comment: this example uses public (signed) tokens, not local (encrypted).

Apply this diff:

-	// Paseto Middleware with local (encrypted) token
+	// Paseto Middleware with public (signed) token

76-76: Resolve markdownlint MD010 (hard tabs) or disable for code blocks.

Either replace leading tabs with spaces on changed lines or disable MD010 for fenced code blocks.

Option A — replace tabs with spaces on changed lines:

-	pasetoware "github.com/gofiber/contrib/v3/paseto/v2"
+    pasetoware "github.com/gofiber/contrib/v3/paseto/v2"
-	pasetoware "github.com/gofiber/contrib/v3/paseto/v2"
+    pasetoware "github.com/gofiber/contrib/v3/paseto/v2"
-	pasetoware "github.com/gofiber/contrib/v3/paseto/v2"
+    pasetoware "github.com/gofiber/contrib/v3/paseto/v2"

Option B — wrap file (or sections) with:

<!-- markdownlint-disable MD010 -->
...code blocks...
<!-- markdownlint-enable MD010 -->

Also applies to: 174-174, 289-289

fibernewrelic/README.md (2)

19-22: Add a language hint to the install code fence (markdownlint MD040).

Specify the shell language to satisfy linters and enable syntax highlighting.

-```
+```bash
 go get -u github.com/gofiber/fiber/v3
 go get -u github.com/gofiber/contrib/v3/fibernewrelic/v2

---

`49-51`: **Import path updates LGTM; replace hard tabs with spaces (markdownlint MD010).**

Tabs trigger MD010 in docs; switch to spaces to keep CI green.


```diff
-import (
-	"github.com/gofiber/fiber/v3"
-	"github.com/gofiber/contrib/v3/fibernewrelic/v2"
-)
+import (
+  "github.com/gofiber/fiber/v3"
+  "github.com/gofiber/contrib/v3/fibernewrelic/v2"
+)

Also applies to: 79-81

circuitbreaker/circuitbreaker_test.go (1)

716-716: Use header name constant for consistency

Prefer the constant for the header key to avoid typos.

-        require.Equal(t, fiber.MIMEApplicationJSONCharsetUTF8, resp.Header.Get("Content-Type"))
+        require.Equal(t, fiber.MIMEApplicationJSONCharsetUTF8, resp.Header.Get(fiber.HeaderContentType))
monitor/monitor.go (1)

83-101: Make JSON negotiation resilient to complex Accept headers

Equality on Accept can miss common cases (multiple types, q-values). Consider a contains check (or c.Accepts(...) if available).

-        if c.Get(fiber.HeaderAccept) == fiber.MIMEApplicationJSON || cfg.APIOnly {
+        if cfg.APIOnly || strings.Contains(c.Get(fiber.HeaderAccept), fiber.MIMEApplicationJSON) {

Add missing import outside this hunk:

import (
  "os"
  "runtime"
  "sync"
  "sync/atomic"
  "time"
  "strings"
  // ...
)
hcaptcha/README.md (1)

19-20: Avoid duplicating the v3 support note

You already have a “This middleware only supports Fiber v3” caution below. Consider removing this extra line to keep docs tight.

-This middleware supports Fiber v3.
monitor/monitor_test.go (1)

156-160: Benchmark assertion likely needs the charset variant too

For consistency with other tests (and Fiber v3 behavior), assert the charset-inclusive MIME here as well.

-    fiber.MIMEApplicationJSON,
+    fiber.MIMEApplicationJSONCharsetUTF8,
websocket/README.md (2)

19-22: Add language to fenced code block (markdownlint MD040).

Mark the install snippet as bash.

-```
+```bash
 go get -u github.com/gofiber/fiber/v3
 go get -u github.com/gofiber/contrib/v3/websocket/v2

---

`53-53`: **Replace hard tab with spaces in code block (MD010).**

Minor formatting to satisfy markdownlint.


```diff
-	"github.com/gofiber/contrib/v3/websocket/v2"
+    "github.com/gofiber/contrib/v3/websocket/v2"
monitor/README.md (1)

19-22: Add language to fenced code block (markdownlint MD040).

-```
+```bash
 go get -u github.com/gofiber/fiber/v3
 go get -u github.com/gofiber/contrib/v3/monitor/v2

</blockquote></details>
<details>
<summary>fgprof/README.md (2)</summary><blockquote>

`30-31`: **Value Ctx in Config and minor table nit.**

- Switching Next to use fiber.Ctx by value is aligned with Fiber v3.
- Minor grammar: drop the trailing period from the type cell.


Apply:

```diff
-| Next     | `func(c fiber.Ctx) bool` | A function to skip this middleware when returned `true`.                                                                                         | `nil`   |
-| Prefix   | `string`.                 | Prefix defines a URL prefix added before "/debug/fgprof". Note that it should start with (but not end with) a slash. Example: "/federated-fiber" | `""`    |
+| Next     | `func(c fiber.Ctx) bool` | A function to skip this middleware when returned `true`.                                                                                         | `nil`   |
+| Prefix   | `string`                 | Prefix defines a URL prefix added before "/debug/fgprof". Note that it should start with (but not end with) a slash. Example: "/federated-fiber" | `""`    |

19-19: Tiny grammar polish.

“Using fgprof to profiling your Fiber app.” → “Use fgprof to profile your Fiber app.”

-Using fgprof to profiling your Fiber app.
+Use fgprof to profile your Fiber app.
testcontainers/README.md (2)

26-27: Use “service implementation” instead of “middleware”.

This package integrates as a Fiber service, not middleware. Wording tweak avoids confusion.

-This middleware supports Fiber v3.
+This service implementation supports Fiber v3.

220-229: Remove unused fmt import in the example.

fmt isn’t used; example won’t compile as-is.

-import (
- "fmt"
- "log"
+import (
+ "log"
swagger/README.md (1)

100-106: Config.Next now takes fiber.Ctx — good. Also fix minor docs lint.

  • The signature change is correct.
  • markdownlint flagged hard tabs in this code block; convert leading tabs to spaces to satisfy MD010.
  • Typo earlier: “latests” → “latest”.
-Swagger is tested on the latests [Go versions](https://golang.org/dl/) with support for modules. So make sure to initialize one first if you didn't do that yet:
+Swagger is tested on the latest [Go versions](https://golang.org/dl/) with support for modules. So make sure to initialize one first if you didn't do that yet:

Tip: run markdownlint with MD010 enabled and replace tabs with spaces in code blocks here.

fibersentry/README.md (1)

87-94: Markdown lint: replace hard tabs with spaces.

The README triggers MD010 for these lines; converting tabs to spaces will clear it.

socketio/README.md (1)

19-22: Add language to fenced Install block

Improves rendering and satisfies markdownlint MD040.

-```
+```bash
 go get -u github.com/gofiber/fiber/v3
 go get -u github.com/gofiber/contrib/v3/socketio/v2

</blockquote></details>
<details>
<summary>fiberi18n/README.md (2)</summary><blockquote>

`19-22`: **Add language to fenced Install block**

Satisfies markdownlint MD040.



```diff
-```
+```bash
 go get -u github.com/gofiber/fiber/v3
 go get -u github.com/gofiber/contrib/v3/fiberi18n/v3

---

`53-57`: **Replace hard tabs with spaces in code blocks**

markdownlint MD010 flags hard tabs; convert leading tabs to spaces.



Example (apply similarly across the snippet):

```diff
-	"github.com/gofiber/contrib/v3/fiberi18n/v3"
-	"github.com/gofiber/fiber/v3"
+    "github.com/gofiber/contrib/v3/fiberi18n/v3"
+    "github.com/gofiber/fiber/v3"

Also applies to: 68-85

opafiber/README.md (2)

19-22: Add language to fenced Install block

Satisfies markdownlint MD040.

-```
+```bash
 go get -u github.com/gofiber/fiber/v3
 go get -u github.com/gofiber/contrib/v3/opafiber/v3

---

`103-105`: **Prefer constant for OK status**

Minor readability consistency with other uses of `fiber.Status*`.



```diff
-		return ctx.SendStatus(200)
+		return ctx.SendStatus(fiber.StatusOK)
loadshed/README.md (2)

117-119: Tighten wording in config table.

Small grammar/punctuation fixes.

-| Next     | `func(fiber.Ctx) bool`    | Function to skip this middleware when returned true.    | `nil`                   |
+| Next     | `func(fiber.Ctx) bool`    | Function to skip this middleware when it returns true.  | `nil`                   |
-| OnShed   | `func(c fiber.Ctx) error` | Function to be executed if a request should be declined | `nil`                   |
+| OnShed   | `func(c fiber.Ctx) error` | Function executed when a request is declined.           | `nil`                   |

88-101: markdownlint MD010 (hard tabs) in code blocks.

Either replace tabs with spaces in code blocks or disable MD010 for fenced code blocks via config/front-matter.

Also applies to: 103-107

casbin/README.md (2)

18-21: Add language to fenced code block.

Helps renderers and MD linters.

-```
+```sh
 go get -u github.com/gofiber/fiber/v3
 go get -u github.com/gofiber/contrib/v3/casbin/v2

---

`44-46`: **Validate external example links after v3 move.**

The example URLs may have shifted with the contrib/v3 restructure. Please verify or update.

</blockquote></details>
<details>
<summary>otelfiber/README.md (3)</summary><blockquote>

`21-23`: **Add language to Install fenced block.**

```diff
-```
+```sh
 go get -u github.com/gofiber/contrib/v3/otelfiber/v3

---

`37-37`: **Grammar/punctuation in WithNext description.**

```diff
-| `WithNext`                    | `func(fiber.Ctx) bool`         | Define a function to skip this middleware when returned true .| nil                                                                 |
+| `WithNext`                    | `func(fiber.Ctx) bool`         | Define a function to skip this middleware when it returns true. | nil                                                                 |

66-66: markdownlint MD010 (hard tabs) in code blocks.

Either keep tabs (Go convention) and ignore MD010 for fenced blocks, or convert to spaces in docs snippets.

Also applies to: 92-96

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 9f98f1b and c538130.

⛔ Files ignored due to path filters (22)
  • casbin/go.mod is excluded by !**/*.mod
  • circuitbreaker/go.mod is excluded by !**/*.mod
  • fgprof/go.mod is excluded by !**/*.mod
  • fiberi18n/go.mod is excluded by !**/*.mod
  • fibernewrelic/go.mod is excluded by !**/*.mod
  • fibersentry/go.mod is excluded by !**/*.mod
  • fiberzap/go.mod is excluded by !**/*.mod
  • fiberzerolog/go.mod is excluded by !**/*.mod
  • hcaptcha/go.mod is excluded by !**/*.mod
  • jwt/go.mod is excluded by !**/*.mod
  • loadshed/go.mod is excluded by !**/*.mod
  • monitor/go.mod is excluded by !**/*.mod
  • opafiber/go.mod is excluded by !**/*.mod
  • otelfiber/example/go.mod is excluded by !**/*.mod
  • otelfiber/example/go.sum is excluded by !**/*.sum, !**/*.sum
  • otelfiber/go.mod is excluded by !**/*.mod
  • paseto/go.mod is excluded by !**/*.mod
  • socketio/go.mod is excluded by !**/*.mod
  • socketio/go.sum is excluded by !**/*.sum, !**/*.sum
  • swagger/go.mod is excluded by !**/*.mod
  • testcontainers/go.mod is excluded by !**/*.mod
  • websocket/go.mod is excluded by !**/*.mod
📒 Files selected for processing (34)
  • casbin/README.md (8 hunks)
  • circuitbreaker/README.md (10 hunks)
  • circuitbreaker/circuitbreaker_test.go (1 hunks)
  • fgprof/README.md (2 hunks)
  • fgprof/fgprof_test.go (1 hunks)
  • fiberi18n/README.md (3 hunks)
  • fiberi18n/example/main.go (1 hunks)
  • fibernewrelic/README.md (5 hunks)
  • fibersentry/README.md (5 hunks)
  • fiberzap/README.md (6 hunks)
  • fiberzerolog/README.md (4 hunks)
  • hcaptcha/README.md (3 hunks)
  • jwt/README.md (4 hunks)
  • jwt/jwt_test.go (1 hunks)
  • loadshed/README.md (7 hunks)
  • loadshed/loadshed_test.go (1 hunks)
  • monitor/README.md (3 hunks)
  • monitor/monitor.go (1 hunks)
  • monitor/monitor_test.go (2 hunks)
  • opafiber/README.md (5 hunks)
  • otelfiber/README.md (4 hunks)
  • otelfiber/doc.go (1 hunks)
  • otelfiber/example/server.go (1 hunks)
  • otelfiber/fiber.go (2 hunks)
  • otelfiber/otelfiber_test/fiber_test.go (2 hunks)
  • paseto/README.md (5 hunks)
  • socketio/README.md (4 hunks)
  • socketio/socketio.go (1 hunks)
  • socketio/socketio_test.go (1 hunks)
  • swagger/README.md (2 hunks)
  • testcontainers/README.md (4 hunks)
  • testcontainers/examples_test.go (1 hunks)
  • testcontainers/testcontainers_test.go (1 hunks)
  • websocket/README.md (2 hunks)
🧰 Additional context used
🧠 Learnings (11)
📓 Common learnings
Learnt from: ReneWerner87
PR: gofiber/fiber#3161
File: app.go:923-932
Timestamp: 2024-11-15T07:56:21.623Z
Learning: In the Fiber framework, breaking changes are acceptable when moving from version 2 to version 3, including modifications to method signatures such as in the `Test` method in `app.go`.
Learnt from: sixcolors
PR: gofiber/fiber#3446
File: docs/middleware/logger.md:44-44
Timestamp: 2025-05-13T00:19:16.407Z
Learning: In documentation files for the Fiber framework, code examples are often partial and don't repeat import statements that were shown in earlier examples, focusing instead on demonstrating specific usage patterns.
Learnt from: ReneWerner87
PR: gofiber/contrib#0
File: :0-0
Timestamp: 2024-11-21T11:28:14.554Z
Learning: Using `fiber.Ctx`, even when wrapped, does not achieve version independence, as it still relies on the specific Fiber implementation.
Learnt from: ReneWerner87
PR: gofiber/contrib#0
File: :0-0
Timestamp: 2024-11-29T15:24:06.083Z
Learning: When customizing the Fiber context to achieve version independence, using generics in methods like `Status` and `Type` allows for fluent method chaining. Implementing a generic interface for `Ctx` on the `App` prevents class switching when registering custom contexts that use fluent methods. Providing multiple `New` methods allows users who do not wish to customize the context to continue using `fiber.New` without changes.
Learnt from: gaby
PR: gofiber/fiber#3193
File: middleware/cache/cache_test.go:897-897
Timestamp: 2024-11-08T04:10:42.990Z
Learning: In the Fiber framework, `Context()` is being renamed to `RequestCtx()`, and `UserContext()` to `Context()` to improve clarity and align with Go's context conventions.
📚 Learning: 2025-02-12T11:24:31.153Z
Learnt from: ReneWerner87
PR: gofiber/storage#0
File: :0-0
Timestamp: 2025-02-12T11:24:31.153Z
Learning: The storage package in gofiber/storage repository can be used independently of the Fiber web framework.

Applied to files:

  • jwt/README.md
📚 Learning: 2024-11-15T07:56:21.623Z
Learnt from: ReneWerner87
PR: gofiber/fiber#3161
File: app.go:923-932
Timestamp: 2024-11-15T07:56:21.623Z
Learning: In the Fiber framework, breaking changes are acceptable when moving from version 2 to version 3, including modifications to method signatures such as in the `Test` method in `app.go`.

Applied to files:

  • otelfiber/fiber.go
  • fiberi18n/example/main.go
  • circuitbreaker/circuitbreaker_test.go
  • socketio/socketio_test.go
  • otelfiber/example/server.go
  • otelfiber/doc.go
  • testcontainers/README.md
  • otelfiber/otelfiber_test/fiber_test.go
  • monitor/monitor_test.go
  • websocket/README.md
  • fibersentry/README.md
  • fibernewrelic/README.md
  • socketio/README.md
  • fiberzerolog/README.md
  • casbin/README.md
  • fiberi18n/README.md
  • circuitbreaker/README.md
  • fiberzap/README.md
  • otelfiber/README.md
  • opafiber/README.md
📚 Learning: 2024-10-16T10:04:06.328Z
Learnt from: ReneWerner87
PR: gofiber/contrib#0
File: :0-0
Timestamp: 2024-10-16T10:04:06.328Z
Learning: The i18n functionality in the gofiber/contrib repository is being refactored from middleware to a global container to improve robustness and performance. The global container will be initialized once before setting up routes and will manage the i18n bundle and localizer map.

Applied to files:

  • fiberi18n/example/main.go
  • fiberi18n/README.md
📚 Learning: 2024-10-08T19:06:06.583Z
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-08T19:06:06.583Z
Learning: Unit tests in this project use testify require.

Applied to files:

  • testcontainers/README.md
  • otelfiber/otelfiber_test/fiber_test.go
  • testcontainers/testcontainers_test.go
📚 Learning: 2024-07-26T21:00:12.902Z
Learnt from: sixcolors
PR: gofiber/fiber#2922
File: middleware/cors/utils.go:63-71
Timestamp: 2024-07-26T21:00:12.902Z
Learning: The project uses the testify/assert package for assertions in unit tests.

Applied to files:

  • testcontainers/README.md
  • otelfiber/otelfiber_test/fiber_test.go
  • testcontainers/testcontainers_test.go
📚 Learning: 2025-04-20T23:52:03.362Z
Learnt from: mdelapenya
PR: gofiber/storage#1665
File: cassandra/cassandra_test.go:35-38
Timestamp: 2025-04-20T23:52:03.362Z
Learning: In testcontainers-go, calling `testcontainers.CleanupContainer(t, c)` before checking the error from container creation is safe due to the implementation details of the library. The CleanupContainer function handles nil or partially initialized containers gracefully.

Applied to files:

  • testcontainers/README.md
  • testcontainers/testcontainers_test.go
📚 Learning: 2024-11-23T19:50:41.765Z
Learnt from: norri
PR: gofiber/recipes#2701
File: clean-code/app/server/server.go:14-16
Timestamp: 2024-11-23T19:50:41.765Z
Learning: In the `clean-code` example at `clean-code/app/server/server.go` using the Go Fiber framework, it's acceptable to omit production-level features like context usage and graceful shutdown handling to keep the example simple.

Applied to files:

  • fgprof/README.md
  • fibersentry/README.md
  • fibernewrelic/README.md
  • fiberzap/README.md
📚 Learning: 2024-12-13T08:14:22.851Z
Learnt from: efectn
PR: gofiber/fiber#3162
File: hooks_test.go:228-228
Timestamp: 2024-12-13T08:14:22.851Z
Learning: In Go test files, prefer using the `require` methods from the `testify` package for assertions instead of manual comparisons and calls to `t.Fatal` or `t.Fatalf`.

Applied to files:

  • otelfiber/otelfiber_test/fiber_test.go
  • testcontainers/testcontainers_test.go
📚 Learning: 2024-11-10T23:44:13.704Z
Learnt from: gaby
PR: gofiber/fiber#3193
File: middleware/adaptor/adaptor.go:111-111
Timestamp: 2024-11-10T23:44:13.704Z
Learning: In the `middleware/adaptor/adaptor.go` file of the Fiber framework, when updating context handling, replacing `c.Context()` with `c.RequestCtx()` is appropriate to access the `fasthttp.RequestCtx`.

Applied to files:

  • fibersentry/README.md
  • socketio/README.md
  • opafiber/README.md
📚 Learning: 2024-10-08T19:06:06.583Z
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/config.go:122-122
Timestamp: 2024-10-08T19:06:06.583Z
Learning: In `DefaultErrorHandler(c *fiber.Ctx, err error)`, since `c` is a pointer to an interface, we need to dereference `*c` when calling interface methods like `SendStatus`.

Applied to files:

  • otelfiber/README.md
🪛 GitHub Actions: Test Fgprof
fgprof/fgprof_test.go

[error] 59-59: go test -v -race ./...: Test_Fgprof_Path failed: Not equal: expected 200, actual 400.


[error] 74-74: go test -v -race ./...: Test_Fgprof_Path_WithPrefix failed: expected nil, actual error: test: got empty response.


[error] 75-75: go test -v -race ./...: Panic: runtime error: invalid memory address or nil pointer dereference in Test_Fgprof_Path_WithPrefix.

🪛 LanguageTool
fgprof/README.md

[grammar] ~30-~30: There might be a mistake here.
Context: ... | nil | | Prefix | string. |...

(QB_NEW_EN)

swagger/README.md

[grammar] ~38-~38: There might be a mistake here.
Context: .../contrib/v3/swagger/v2 ### Examples Import the middleware packagego impo...

(QB_NEW_EN)

fiberzerolog/README.md

[grammar] ~42-~42: There might be a mistake here.
Context: ...zerolog.WarnLevel, zerolog.InfoLevel}| | SkipURIs |[]string` ...

(QB_NEW_EN)


[grammar] ~43-~43: There might be a mistake here.
Context: ... | | GetResBody | func(c fiber.Ctx) []by...

(QB_NEW_EN)


[grammar] ~44-~44: There might be a mistake here.
Context: ...Ctx) []byte | Define a function to get response body when return non-nil.<br /...

(QB_NEW_EN)


[grammar] ~44-~44: There might be a mistake here.
Context: ...eadable. you can set GetResBody func to get readable resBody. ...

(QB_NEW_EN)

casbin/README.md

[grammar] ~40-~40: There might be a mistake here.
Context: ... | | Forbidden | `func(fiber.Ctx) error...

(QB_NEW_EN)

fiberi18n/README.md

[grammar] ~36-~36: There might be a mistake here.
Context: ... | | RootPath | string ...

(QB_NEW_EN)

fiberzap/README.md

[grammar] ~36-~36: There might be a mistake here.
Context: ... | | Fields | []string ...

(QB_NEW_EN)


[grammar] ~37-~37: Ensure spelling is correct
Context: ...[]string | Add fields what you want see. ...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~40-~40: There might be a mistake here.
Context: ...zapcore.WarnLevel, zapcore.InfoLevel}| | SkipURIs |[]string` ...

(QB_NEW_EN)


[grammar] ~42-~42: There might be a mistake here.
Context: ...iber.Ctx) []byte | Define a function to get response body when return non-nil.<br /...

(QB_NEW_EN)


[grammar] ~42-~42: There might be a mistake here.
Context: ...eadable. you can set GetResBody func to get readable resBody. | nil ...

(QB_NEW_EN)

loadshed/README.md

[grammar] ~117-~117: There might be a mistake here.
Context: ...ned true. | nil | | Criteria | LoadCriteria ...

(QB_NEW_EN)

otelfiber/README.md

[grammar] ~37-~37: There might be a mistake here.
Context: ... | | WithTracerProvider | `otelt...

(QB_NEW_EN)


[grammar] ~38-~38: There might be a mistake here.
Context: ...used | | WithMeterProvider | `otelm...

(QB_NEW_EN)


[grammar] ~41-~41: There might be a mistake here.
Context: ...he HTTP requests. | If none are specified, global ones will be used | | (❌ Removed) WithServerName ...

(QB_NEW_EN)


[grammar] ~45-~45: There might be a mistake here.
Context: ...ributes to the metrics. | nil | | WithCollectClientIP | bool ...

(QB_NEW_EN)

🪛 GitHub Actions: Test otelfiber
otelfiber/otelfiber_test/fiber_test.go

[error] 105-105: go test -v -race ./... failed: TestTrace200 panicked with runtime error: invalid memory address or nil pointer dereference (fiber_test.go:105).

🪛 markdownlint-cli2 (0.17.2)
websocket/README.md

19-19: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


53-53: Hard tabs
Column: 1

(MD010, no-hard-tabs)

swagger/README.md

104-104: Hard tabs
Column: 1

(MD010, no-hard-tabs)

fibersentry/README.md

87-87: Hard tabs
Column: 1

(MD010, no-hard-tabs)


88-88: Hard tabs
Column: 1

(MD010, no-hard-tabs)


89-89: Hard tabs
Column: 1

(MD010, no-hard-tabs)


90-90: Hard tabs
Column: 1

(MD010, no-hard-tabs)


91-91: Hard tabs
Column: 1

(MD010, no-hard-tabs)


92-92: Hard tabs
Column: 1

(MD010, no-hard-tabs)


93-93: Hard tabs
Column: 1

(MD010, no-hard-tabs)


94-94: Hard tabs
Column: 1

(MD010, no-hard-tabs)

fibernewrelic/README.md

19-19: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


51-51: Hard tabs
Column: 1

(MD010, no-hard-tabs)


52-52: Hard tabs
Column: 1

(MD010, no-hard-tabs)


54-54: Hard tabs
Column: 1

(MD010, no-hard-tabs)


55-55: Hard tabs
Column: 1

(MD010, no-hard-tabs)


56-56: Hard tabs
Column: 1

(MD010, no-hard-tabs)


79-79: Hard tabs
Column: 1

(MD010, no-hard-tabs)


92-92: Hard tabs
Column: 1

(MD010, no-hard-tabs)


93-93: Hard tabs
Column: 1

(MD010, no-hard-tabs)


95-95: Hard tabs
Column: 1

(MD010, no-hard-tabs)


96-96: Hard tabs
Column: 1

(MD010, no-hard-tabs)

socketio/README.md

19-19: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

casbin/README.md

18-18: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

fiberi18n/README.md

70-70: Hard tabs
Column: 1

(MD010, no-hard-tabs)

paseto/README.md

76-76: Hard tabs
Column: 1

(MD010, no-hard-tabs)


174-174: Hard tabs
Column: 1

(MD010, no-hard-tabs)


289-289: Hard tabs
Column: 1

(MD010, no-hard-tabs)

fiberzap/README.md

21-21: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


66-66: Hard tabs
Column: 1

(MD010, no-hard-tabs)


98-98: Hard tabs
Column: 1

(MD010, no-hard-tabs)


111-111: Hard tabs
Column: 1

(MD010, no-hard-tabs)


112-112: Hard tabs
Column: 1

(MD010, no-hard-tabs)


113-113: Hard tabs
Column: 1

(MD010, no-hard-tabs)


114-114: Hard tabs
Column: 1

(MD010, no-hard-tabs)


115-115: Hard tabs
Column: 1

(MD010, no-hard-tabs)


116-116: Hard tabs
Column: 1

(MD010, no-hard-tabs)

loadshed/README.md

88-88: Hard tabs
Column: 1

(MD010, no-hard-tabs)


103-103: Hard tabs
Column: 1

(MD010, no-hard-tabs)

otelfiber/README.md

66-66: Hard tabs
Column: 1

(MD010, no-hard-tabs)


92-92: Hard tabs
Column: 1

(MD010, no-hard-tabs)


93-93: Hard tabs
Column: 1

(MD010, no-hard-tabs)


94-94: Hard tabs
Column: 1

(MD010, no-hard-tabs)


96-96: Hard tabs
Column: 1

(MD010, no-hard-tabs)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (19)
  • GitHub Check: lint (opafiber)
  • GitHub Check: lint (paseto)
  • GitHub Check: lint (circuitbreaker)
  • GitHub Check: lint (otelfiber)
  • GitHub Check: lint (swagger)
  • GitHub Check: lint (hcaptcha)
  • GitHub Check: lint (casbin)
  • GitHub Check: lint (fibersentry)
  • GitHub Check: lint (fiberzap)
  • GitHub Check: lint (socketio)
  • GitHub Check: lint (testcontainers)
  • GitHub Check: lint (monitor)
  • GitHub Check: lint (jwt)
  • GitHub Check: lint (loadshed)
  • GitHub Check: lint (fgprof)
  • GitHub Check: lint (websocket)
  • GitHub Check: lint (fiberzerolog)
  • GitHub Check: lint (fibernewrelic)
  • GitHub Check: lint (fiberi18n)
🔇 Additional comments (47)
jwt/jwt_test.go (1)

17-17: All JWT imports updated to v3/v2; no legacy imports found.

jwt/README.md (4)

26-26: Install line: module path update LGTM.

go get -u github.com/gofiber/contrib/v3/jwt/v2 matches the v3 repo layout while keeping jwt at v2.


60-60: Example import path update LGTM.

Import alias and v3/v2 path are consistent with tests and PR goals.


168-168: RS256 example import path update LGTM.

Consistent with the new layout.


277-277: Custom KeyFunc example import path update LGTM.

Consistent with other examples.

fiberzerolog/README.md (1)

65-65: LGTM: value-based handler signature for Fiber v3

func(c fiber.Ctx) error matches v3’s handler form.

fiberzap/README.md (2)

66-71: LGTM: v3 handler uses value-based fiber.Ctx.


111-115: Context API methods updated correctly for Fiber v3
UserContext() has been replaced with Context(), SetUserContext() with SetContext(), and all tabs have been converted to spaces.

paseto/README.md (2)

25-27: Module path bump looks correct.

Import path updated to contrib/v3/paseto/v2 as expected for v3 migration.


40-40: Fix type: document Next as func(fiber.Ctx) bool.

Keep it consistent with signatures above and v3 value Ctx usage.

Apply this diff:

-| Next           | `func(Ctx) bool`               | Defines a function to skip middleware                                     | `nil` |
+| Next           | `func(fiber.Ctx) bool`         | Defines a function to skip middleware                                     | `nil` |
⛔ Skipped due to learnings
Learnt from: gaby
PR: gofiber/fiber#3193
File: middleware/cache/cache_test.go:897-897
Timestamp: 2024-11-08T04:10:42.990Z
Learning: In the Fiber framework, `Context()` is being renamed to `RequestCtx()`, and `UserContext()` to `Context()` to improve clarity and align with Go's context conventions.
Learnt from: gaby
PR: gofiber/fiber#3193
File: middleware/adaptor/adaptor.go:111-111
Timestamp: 2024-11-10T23:44:13.704Z
Learning: In the `middleware/adaptor/adaptor.go` file of the Fiber framework, when updating context handling, replacing `c.Context()` with `c.RequestCtx()` is appropriate to access the `fasthttp.RequestCtx`.
Learnt from: ReneWerner87
PR: gofiber/contrib#0
File: :0-0
Timestamp: 2024-11-29T15:24:06.083Z
Learning: When customizing the Fiber context to achieve version independence, using generics in methods like `Status` and `Type` allows for fluent method chaining. Implementing a generic interface for `Ctx` on the `App` prevents class switching when registering custom contexts that use fluent methods. Providing multiple `New` methods allows users who do not wish to customize the context to continue using `fiber.New` without changes.
fibernewrelic/README.md (3)

15-16: V3 compatibility note looks good.

Clear and aligned with the repo-wide migration.


39-41: Signature table: switch to value-based fiber.Ctx is correct.

Matches Fiber v3 conventions for middleware config callbacks.


56-58: Handler parameter type change to fiber.Ctx is correct.

Matches the v3 value receiver style for handlers.

Also applies to: 92-95

testcontainers/testcontainers_test.go (1)

8-8: Import path bump looks correct

The v3 contrib path with testcontainers submodule v2 matches the repo’s new layout. No further changes needed.

socketio/socketio.go (1)

9-9: LGTM on v3 websocket import path

Import path switch to github.com/gofiber/contrib/v3/websocket/v2 aligns with the v3 layout. No functional changes needed here.

socketio/socketio_test.go (1)

12-12: LGTM on test import path

Test import updated to github.com/gofiber/contrib/v3/websocket/v2 in sync with the module bump. All good.

testcontainers/examples_test.go (1)

9-9: Import path bump to contrib/v3/testcontainers/v2 looks correct

Matches the v3 repo layout with the module’s own /v2 major. No further changes needed here.

monitor/monitor.go (1)

79-81: By-value Ctx in Next: migration looks good

Switching to cfg.Next(c) aligns with Fiber v3’s by-value Ctx.

hcaptcha/README.md (1)

31-31: v3 module path updates look correct

Install and import paths now point to github.com/gofiber/contrib/v3/hcaptcha/v2. LGTM.

Also applies to: 54-54

monitor/monitor_test.go (2)

126-126: Update to charset-aware JSON MIME: good change

Asserting fiber.MIMEApplicationJSONCharsetUTF8 matches Fiber v3 behavior.


192-192: Consistent Content-Type assertion: good change

Aligned with JSON writer’s charset-included header.

loadshed/loadshed_test.go (1)

267-267: LGTM: assert against Fiber’s MIME constant.

Good switch to fiber.MIMEApplicationJSONCharsetUTF8; avoids hardcoding and tracks upstream defaults.

websocket/README.md (1)

15-16: Fiber v3 note added — OK.

otelfiber/fiber.go (2)

8-9: Internal import path updated to v3 — OK.


21-24: Instrumentation name bumped to v3 — OK.

otelfiber/otelfiber_test/fiber_test.go (2)

11-11: Import path switched to v3 — OK.


31-31: Test instrumentationName updated — OK.

monitor/README.md (2)

21-22: Install path updated to v3 — OK.


37-37: Invocation uses value Ctx correctly — monitor/monitor.go already calls cfg.Next(c) (line 79), matching the updated func(fiber.Ctx) bool signature.

fgprof/README.md (3)

23-23: Import path bump looks correct.

The go get path reflects contrib v3 with fgprof v2, consistent with the repo’s new layout.


41-41: Updated import path LGTM.

Using github.com/gofiber/contrib/v3/fgprof/v2 matches the install instructions.


48-49: Handler signature updated to value Ctx — good.

func(c fiber.Ctx) error matches Fiber v3.

testcontainers/README.md (3)

36-39: Install commands look right.

Paths reflect Fiber v3 and contrib v3/testcontainers v2.


226-227: Updated import path LGTM.

github.com/gofiber/contrib/v3/testcontainers/v2 is consistent with the install step.


278-279: Second example import path LGTM.

Consistent with the new module layout.

swagger/README.md (2)

35-35: Install path bump LGTM.

Using github.com/gofiber/contrib/v3/swagger/v2 is consistent with the migration.


42-44: Imports updated correctly.

Value Ctx usage in examples aligns with v3.

fibersentry/README.md (2)

21-23: Install path bump LGTM.

Contrib v3/fibersentry v2 path matches the new layout.


84-90: Value Ctx usage in middleware and handlers looks good.

enhanceSentryEvent, app.All handlers now use fiber.Ctx — matches v3.

Also applies to: 91-97, 95-103

socketio/README.md (1)

30-31: Updated handler signature to func(fiber.Ctx) error — LGTM

Matches Fiber v3 handler type and the examples below.

fiberi18n/README.md (1)

29-31: Fiber v3 value-based Ctx in API — LGTM

Signatures now use fiber.Ctx (by value) consistently.

Also applies to: 36-36, 44-44

fiberi18n/example/main.go (1)

6-6: Import path bump to v3 — LGTM

Consistent with the repo-wide module layout.

opafiber/README.md (1)

41-41: InputCreationFunc uses value Ctx — LGTM

Type and default reflect Fiber v3 conventions.

Also applies to: 46-47

loadshed/README.md (2)

21-21: Module path and Ctx-by-value updates look correct.

Import path bumped to contrib/v3 and examples use fiber.Ctx by value consistently.

Also applies to: 42-43


58-63: Handler signatures updated to value Ctx — good.

Route handlers now use func(c fiber.Ctx) error, matching Fiber v3.

Also applies to: 103-107

casbin/README.md (1)

15-21: v3 import paths and value-based fiber.Ctx types look good.

Docs match the Fiber v3 migration.

Also applies to: 39-41

otelfiber/README.md (1)

22-23: Import path bump to contrib/v3/otelfiber/v3 — looks correct.

Comment on lines +59 to +61
| OnOpen | `func(fiber.Ctx)` | Callback function when the circuit is opened | `503 response` |
| OnClose | `func(fiber.Ctx)` | Callback function when the circuit is closed | `Continue request` |
| OnHalfOpen | `func(fiber.Ctx)` | Callback function when the circuit is half-open | `429 response` |
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Config callback types should return error

Examples below use func(fiber.Ctx) error; align the table to avoid confusion.

-| OnOpen | `func(fiber.Ctx)` | Callback function when the circuit is opened | `503 response` |
-| OnClose | `func(fiber.Ctx)` | Callback function when the circuit is closed | `Continue request` |
-| OnHalfOpen | `func(fiber.Ctx)` | Callback function when the circuit is half-open | `429 response` |
+| OnOpen | `func(fiber.Ctx) error` | Callback function when the circuit is opened | `503 response` |
+| OnClose | `func(fiber.Ctx) error` | Callback function when the circuit is closed | `Continue request` |
+| OnHalfOpen | `func(fiber.Ctx) error` | Callback function when the circuit is half-open | `429 response` |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| OnOpen | `func(fiber.Ctx)` | Callback function when the circuit is opened | `503 response` |
| OnClose | `func(fiber.Ctx)` | Callback function when the circuit is closed | `Continue request` |
| OnHalfOpen | `func(fiber.Ctx)` | Callback function when the circuit is half-open | `429 response` |
| OnOpen | `func(fiber.Ctx) error` | Callback function when the circuit is opened | `503 response` |
| OnClose | `func(fiber.Ctx) error` | Callback function when the circuit is closed | `Continue request` |
| OnHalfOpen | `func(fiber.Ctx) error` | Callback function when the circuit is half-open | `429 response` |
🤖 Prompt for AI Agents
In circuitbreaker/README.md around lines 59 to 61, the callback type signatures
in the table show func(fiber.Ctx) but should be func(fiber.Ctx) error to match
examples; update the three entries (OnOpen, OnClose, OnHalfOpen) to use
func(fiber.Ctx) error so the docs align with the examples and make a note in the
table cells if necessary that handlers must return an error to control flow.

Comment on lines 56 to 59
// Default fgprof interval is 30 seconds
resp, err := app.Test(httptest.NewRequest("GET", "/debug/fgprof?seconds=1", nil), fiber.TestConfig{Timeout: 1500})
resp, err := app.Test(httptest.NewRequest("GET", "/debug/fgprof?seconds=0", nil))
assert.Equal(t, nil, err)
assert.Equal(t, 200, resp.StatusCode)
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix 400 and timeout: seconds=0 is invalid; also pass a time.Duration timeout

/debug/fgprof rejects seconds=0 with 400. Use a positive value and set fiber.TestConfig.Timeout as a proper time.Duration to avoid “empty response” due to the default/too-small timeout.

 import (
 	"io"
 	"net/http/httptest"
 	"testing"
 
 	"github.com/stretchr/testify/assert"
 
 	"github.com/gofiber/fiber/v3"
+	"time"
 )
@@
 	// Default fgprof interval is 30 seconds
-	resp, err := app.Test(httptest.NewRequest("GET", "/debug/fgprof?seconds=0", nil))
+	resp, err := app.Test(
+		httptest.NewRequest("GET", "/debug/fgprof?seconds=1", nil),
+		fiber.TestConfig{Timeout: 2 * time.Second},
+	)
 	assert.Equal(t, nil, err)
 	assert.Equal(t, 200, resp.StatusCode)

Also applies to: 3-11

🧰 Tools
🪛 GitHub Actions: Test Fgprof

[error] 59-59: go test -v -race ./...: Test_Fgprof_Path failed: Not equal: expected 200, actual 400.

🤖 Prompt for AI Agents
In fgprof/fgprof_test.go around lines 56 to 59 (and similarly lines 3 to 11),
the test passes seconds=0 (which the handler rejects with HTTP 400) and does not
set a proper time.Duration timeout for fiber.Test, causing empty
responses/timeouts; update the test to use a positive seconds value (e.g.
seconds=1 or greater) and configure fiber.TestConfig.Timeout using a
time.Duration (for example time.Second * 5) when calling app.Test so the request
has a valid parameter and enough timeout to complete.

Comment on lines 55 to 58
"github.com/gofiber/contrib/v3/fibersentry/v2"
"github.com/gofiber/fiber/v3"
"github.com/gofiber/fiber/v3/utils"
)
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix example: Hostname already returns string in Fiber v3.

utils.ImmutableString expects []byte; c.Hostname() returns string in v3, so this won’t compile. Drop the utils conversion and import.

 import (
 	"fmt"
 	"log"
 
 	"github.com/getsentry/sentry-go"
-	"github.com/gofiber/contrib/v3/fibersentry/v2"
-	"github.com/gofiber/fiber/v3"
-	"github.com/gofiber/fiber/v3/utils"
+	"github.com/gofiber/contrib/v3/fibersentry/v2"
+	"github.com/gofiber/fiber/v3"
 )
@@
-				if c, ok := hint.Context.Value(sentry.RequestContextKey).(fiber.Ctx); ok {
-					// You have access to the original Context if it panicked
-					fmt.Println(utils.ImmutableString(c.Hostname()))
+				if c, ok := hint.Context.Value(sentry.RequestContextKey).(fiber.Ctx); ok {
+					// You have access to the original Context if it panicked
+					fmt.Println(c.Hostname())
 				}

Hostname returns string in v3 docs. (pkg.go.dev, docs.gofiber.io)

Also applies to: 65-68

🤖 Prompt for AI Agents
In fibersentry/README.md around lines 55 to 58 (and likewise lines 65 to 68),
the code converts c.Hostname() using utils.ImmutableString even though in Fiber
v3 c.Hostname() already returns a string; remove the utils.ImmutableString
conversion and the utils import, and use c.Hostname() directly where previously
wrapped, updating the import block to drop "github.com/gofiber/fiber/v3/utils"
so the file compiles with Fiber v3.

| Next | `func(Ctx) bool` | Define a function to skip this middleware when returned true | `nil` |
| Logger | `*zerolog.Logger` | Add custom zerolog logger. | `zerolog.New(os.Stderr).With().Timestamp().Logger()` |
| GetLogger | `func(*fiber.Ctx) zerolog.Logger` | Get custom zerolog logger, if it's defined the returned logger will replace the `Logger` value. | `nil` |
| GetLogger | `func(fiber.Ctx) zerolog.Logger` | Get custom zerolog logger, if it's defined the returned logger will replace the `Logger` value. | `nil` |
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Match GetLogger return type to Logger field (pointer vs value)

Logger is *zerolog.Logger, but GetLogger returns zerolog.Logger. Make it a pointer to avoid type mismatch.

-| GetLogger        | `func(fiber.Ctx) zerolog.Logger`           | Get custom zerolog logger, if it's defined the returned logger will replace the `Logger` value.                                                                                                                                                                                             | `nil`                                                      |
+| GetLogger        | `func(fiber.Ctx) *zerolog.Logger`          | Return a custom zerolog logger; when set, its result replaces `Logger`.                                                                                                                                                                                                                     | `nil`                                                      |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| GetLogger | `func(fiber.Ctx) zerolog.Logger` | Get custom zerolog logger, if it's defined the returned logger will replace the `Logger` value. | `nil` |
| GetLogger | `func(fiber.Ctx) *zerolog.Logger` | Return a custom zerolog logger; when set, its result replaces `Logger`. | `nil` |
🤖 Prompt for AI Agents
In fiberzerolog/README.md around line 37, the docs show GetLogger as returning a
non-pointer zerolog.Logger while the Logger field is *zerolog.Logger; update the
table cell to show the return type as *zerolog.Logger so it matches the Logger
field type (and adjust any surrounding text or examples to use a
pointer-returning signature if present).

| Levels | `[]zerolog.Level` | Custom response levels. | `[]zerolog.Level{zerolog.ErrorLevel, zerolog.WarnLevel, zerolog.InfoLevel}` |
| SkipURIs | `[]string` | Skip logging these URI. | `[]string{}` |
| GetResBody | func(c *fiber.Ctx) []byte | Define a function to get response body when return non-nil.<br />eg: When use compress middleware, resBody is unreadable. you can set GetResBody func to get readable resBody. | `nil` |
| GetResBody | func(c fiber.Ctx) []byte | Define a function to get response body when return non-nil.<br />eg: When use compress middleware, resBody is unreadable. you can set GetResBody func to get readable resBody. | `nil` |
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Polish GetResBody: add backticks, remove param name, and fix grammar

Improves readability and correctness in the docs.

-| GetResBody    | func(c fiber.Ctx) []byte      | Define a function to get response body when return non-nil.<br />eg: When use compress middleware, resBody is unreadable. you can set GetResBody func to get readable resBody.                                                                                                              | `nil` |
+| GetResBody    | `func(fiber.Ctx) []byte`      | Provide a function that returns a readable response body. When the function returns a non-nil slice, it replaces the default body (e.g., when using the compress middleware).                                                                         | `nil` |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| GetResBody | func(c fiber.Ctx) []byte | Define a function to get response body when return non-nil.<br />eg: When use compress middleware, resBody is unreadable. you can set GetResBody func to get readable resBody. | `nil` |
| GetResBody | `func(fiber.Ctx) []byte` | Provide a function that returns a readable response body. When the function returns a non-nil slice, it replaces the default body (e.g., when using the compress middleware). | `nil` |
🧰 Tools
🪛 LanguageTool

[grammar] ~44-~44: There might be a mistake here.
Context: ...Ctx) []byte | Define a function to get response body when return non-nil.<br /...

(QB_NEW_EN)


[grammar] ~44-~44: There might be a mistake here.
Context: ...eadable. you can set GetResBody func to get readable resBody. ...

(QB_NEW_EN)

🤖 Prompt for AI Agents
In fiberzerolog/README.md around line 44, the GetResBody table cell needs
polishing: wrap the function signature in backticks, remove the concrete
parameter name (use the type only), and fix grammar for clarity — e.g., change
"func(c fiber.Ctx) []byte" to "`func(fiber.Ctx) []byte`", reword the description
to something like "Define a function to obtain the response body when a non-nil
function is provided. For example, when using compression middleware the
response body may be unreadable; set GetResBody to return a readable body." and
keep the default as "`nil`".

Comment on lines 51 to 55
import (
"github.com/gofiber/fiber/v3"
"github.com/gofiber/contrib/fiberzerolog"
"github.com/gofiber/contrib/v3/fiberzerolog/v2"
"github.com/rs/zerolog"
)
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Example won’t compile: missing os import

os.Stderr is used but os isn’t imported.

 import (
+    "os"
     "github.com/gofiber/fiber/v3"
     "github.com/gofiber/contrib/v3/fiberzerolog/v2"
     "github.com/rs/zerolog"
 )
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import (
"github.com/gofiber/fiber/v3"
"github.com/gofiber/contrib/fiberzerolog"
"github.com/gofiber/contrib/v3/fiberzerolog/v2"
"github.com/rs/zerolog"
)
import (
"os"
"github.com/gofiber/fiber/v3"
"github.com/fiber/contrib/v3/fiberzerolog/v2"
"github.com/rs/zerolog"
)
🤖 Prompt for AI Agents
In fiberzerolog/README.md around lines 51 to 55, the example uses os.Stderr but
the "os" package is not imported; add "os" to the import list (e.g., include
"os" alongside the other imports) so the example compiles successfully.

Comment on lines 70 to 73
import (
"github.com/gofiber/fiber/v3"
"github.com/gofiber/contrib/opafiber/v2"
"github.com/gofiber/contrib/v3/opafiber/v3"
)
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Example misses bytes import; code won’t compile

bytes.NewBufferString is used but bytes isn’t imported.

 import (
-	"github.com/gofiber/fiber/v3"
-	"github.com/gofiber/contrib/v3/opafiber/v3"
+	"bytes"
+	"github.com/gofiber/fiber/v3"
+	"github.com/gofiber/contrib/v3/opafiber/v3"
 )

Also applies to: 89-90

🤖 Prompt for AI Agents
In opafiber/README.md around lines 70-73 (and similarly at 89-90), the example
uses bytes.NewBufferString but does not import the bytes package; add "bytes" to
the import block alongside the existing imports so the code compiles, and update
both import sections where bytes.NewBufferString is used.

otelfiber/doc.go Outdated
// Currently, only the routing of a received message can be instrumented. To do
// so, use the Middleware function.
package otelfiber // import" github.com/gofiber/contrib/otelfiber"
package otelfiber // import "github.com/gofiber/contrib/v3/otelfiber/v3"
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Canonical import comment updated — verify it matches go.mod.

Looks correct for v3; please confirm the submodule’s module path to avoid “import path mismatch” errors.


🏁 Script executed:

#!/bin/bash
# Verify otelfiber module path matches the import comment.
rg -nUP '^module\s+github\.com/gofiber/contrib/v3/otelfiber/v3$' -g 'otelfiber/**/go.mod' -S || {
  echo "Expected module path not found in otelfiber go.mod"
  exit 1
}
# Optional: show first lines of the found go.mod for context.
rg -nU 'module ' -g 'otelfiber/**/go.mod' -n -S -C2

Length of output: 363


🏁 Script executed:

#!/bin/bash
# Locate all go.mod files and display their module declarations for verification
find . -type f -name go.mod -print -exec awk 'NR<=3' {} \;

Length of output: 63


🏁 Script executed:

#!/bin/bash
# List files under otelfiber directory
echo "Files under otelfiber:"
find otelfiber -maxdepth 2 -type f -print

# Show contents of otelfiber/doc.go (first 50 lines)
echo -e "\nContents of otelfiber/doc.go:"
if [ -f otelfiber/doc.go ]; then
  sed -n '1,50p' otelfiber/doc.go
else
  echo "otelfiber/doc.go not found"
fi

# Show root go.mod if present
echo -e "\nRoot go.mod:"
if [ -f go.mod ]; then
  sed -n '1,10p' go.mod
else
  echo "No root go.mod found"
fi

Length of output: 929


Add a go.mod in the otelfiber subdirectory with module github.com/gofiber/contrib/v3/otelfiber/v3 to match the import comment.

🤖 Prompt for AI Agents
In otelfiber/doc.go around line 6, the import comment declares module path
github.com/gofiber/contrib/v3/otelfiber/v3 but the otelfiber subdirectory is
missing a go.mod; add a new go.mod in the otelfiber directory with the first
line module github.com/gofiber/contrib/v3/otelfiber/v3, set an appropriate go
directive (e.g. go 1.20), run go mod tidy in that subdirectory to populate
required dependencies and any necessary replace directives, and commit the
go.mod and go.sum files so the package path matches the import comment.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
otelfiber/otelfiber_test/fiber_test.go (1)

373-383: Fix histogram overflow bucket indexing (panic and wrong counts).
When value > last bound, code increments bounds[i+1] (out of range) instead of bucketCounts[i+1].

 for i, v := range bounds {
   if value <= v {
     bucketCounts[i]++
     break
   }

   if i == len(bounds)-1 {
-    bounds[i+1]++
+    bucketCounts[i+1]++
     break
   }
 }
websocket/README.md (1)

121-123: Fix grammar in recover note.
User-facing docs; clarify and correct phrasing.

-For internal implementation reasons, currently recover middleware is not work with websocket middleware, please use `config.RecoverHandler` to add recover handler to websocket endpoints.
-By default, config `RecoverHandler` is recovers from panic and writes stack trace to stderr, also returns a response that contains panic message in **error** field.
+For internal implementation reasons, the recover middleware does not work with the WebSocket middleware. Please use `config.RecoverHandler` to add a recover handler to WebSocket endpoints.
+By default, `RecoverHandler` recovers from panics, writes the stack trace to stderr, and returns a response that contains the panic message in the **error** field.
loadshed/README.md (1)

147-149: Fix unit mismatch in rejection formula (percent vs. fraction).

Thresholds are documented as fractions (e.g., 0.75), but the formula multiplies LowerThreshold by 100. Remove the percent conversion to avoid incorrect probabilities.

-    rejectionProbability := (cpuUsage - LowerThreshold*100) / (UpperThreshold - LowerThreshold)
+    rejectionProbability := (cpuUsage - LowerThreshold) / (UpperThreshold - LowerThreshold)
♻️ Duplicate comments (13)
fiberzap/README.md (5)

42-42: Correct GetResBody type/formatting and wording.

Fix stray backslash, wrap in backticks, and tighten phrasing.

-| GetResBody | func(c \fiber.Ctx) []byte | Define a function to get response body when return non-nil.<br />eg: When use compress middleware, resBody is unreadable. you can set GetResBody func to get readable resBody. | `nil`                                                                       |
+| GetResBody | `func(c fiber.Ctx) []byte` | Return a custom response body when non-nil. For example, when using the compress middleware, the body may be unreadable; set GetResBody to provide a readable body.            | `nil`                                                                       |

19-23: Fix install snippet: wrong module path, missing fence language.

Use the v3 contrib path once and add a shell language for MD040.

-```
+```sh
 go get -u github.com/gofiber/fiber/v3
-go get -u github.com/gofiber/contrib/v3/fiberzap/v1
+go get -u github.com/gofiber/contrib/fiberzap/v3
 go get -u go.uber.org/zap
-```
+```

52-55: Fix import path and minor formatting in example.

Use the correct contrib v3 path and standard Go formatting of func literals.

 import (
     "log"
 
     "github.com/gofiber/fiber/v3"
-    "github.com/gofiber/contrib/v3/fiberzap/v1"
+    "github.com/gofiber/contrib/fiberzap/v3"
     "go.uber.org/zap"
 )
@@
-    app.Get("/", func (c fiber.Ctx) error {
+    app.Get("/", func(c fiber.Ctx) error {
         return c.SendString("Hello, World!")
     })

Also applies to: 66-66


96-101: Replace hard tabs with spaces and fix module path.

Satisfies MD010 and corrects the import.

-import (
-	"context"
-	"github.com/gofiber/contrib/v3/fiberzap/v1"
-	"github.com/gofiber/fiber/v3"
-	"github.com/gofiber/fiber/v3/log"
-)
+import (
+    "context"
+    "github.com/gofiber/contrib/fiberzap/v3"
+    "github.com/gofiber/fiber/v3"
+    "github.com/gofiber/fiber/v3/log"
+)

111-118: Update for Fiber v3: SetUserContext removed; use v3 context API or Locals.

This example will not compile on v3. Replace SetUserContext and UserContext usage.

-    app.Use(func(c fiber.Ctx) error {
-        ctx := context.WithValue(c.UserContext(), "request_id", "123")
-        c.SetUserContext(ctx)
-        return c.Next()
-    })
-    app.Get("/", func(c fiber.Ctx) error {
-        log.WithContext(c.UserContext()).Info("Hello, World!")
-        return c.SendString("Hello, World!")
-    })
+    app.Use(func(c fiber.Ctx) error {
+        // Example: attach request_id for downstream logging without SetUserContext in v3
+        // Option A: store in Locals and have fiberzap read it (recommended if supported by LoggerConfig/FieldsFunc)
+        c.Locals("request_id", "123")
+        return c.Next()
+    })
+    app.Get("/", func(c fiber.Ctx) error {
+        // If you need a context-bound logger for this scope:
+        l := log.WithContext(context.WithValue(c.Context(), "request_id", "123"))
+        l.Info("Hello, World!")
+        return c.SendString("Hello, World!")
+    })

If fiberzap.LoggerConfig/FieldsFunc supports extracting from Locals, prefer that and drop the per-handler WithContext snippet. Please confirm the intended pattern for v3 so we can align the docs accordingly.

fibersentry/README.md (1)

55-58: Fix example: Hostname already returns string in Fiber v3; drop utils.ImmutableString and utils import

The code won’t compile: utils.ImmutableString([]byte) expects []byte but c.Hostname() returns string. Remove the utils import and print c.Hostname() directly.

 import (
 	"fmt"
 	"log"
 
 	"github.com/getsentry/sentry-go"
-	"github.com/gofiber/contrib/v3/fibersentry/v1"
-	"github.com/gofiber/fiber/v3"
-	"github.com/gofiber/fiber/v3/utils"
+	"github.com/gofiber/contrib/v3/fibersentry/v1"
+	"github.com/gofiber/fiber/v3"
 )
@@
 			if hint.Context != nil {
 				if c, ok := hint.Context.Value(sentry.RequestContextKey).(fiber.Ctx); ok {
 					// You have access to the original Context if it panicked
-					fmt.Println(utils.ImmutableString(c.Hostname()))
+					fmt.Println(c.Hostname())
 				}
 			}

Also applies to: 65-68

circuitbreaker/README.md (2)

59-61: Docs-table callback signatures should return error

Examples below return error; align the table to avoid confusion.

-| OnOpen | `func(fiber.Ctx)` | Callback function when the circuit is opened | `503 response` |
-| OnClose | `func(fiber.Ctx)` | Callback function when the circuit is closed | `Continue request` |
-| OnHalfOpen | `func(fiber.Ctx)` | Callback function when the circuit is half-open | `429 response` |
+| OnOpen | `func(fiber.Ctx) error` | Callback function when the circuit is opened | `503 response` |
+| OnClose | `func(fiber.Ctx) error` | Callback function when the circuit is closed | `Continue request` |
+| OnHalfOpen | `func(fiber.Ctx) error` | Callback function when the circuit is half-open | `429 response` |

76-79: Example missing time import; won’t compile

Add time to the import list (used by 5*time.Second, etc.).

 import (
 	"github.com/gofiber/fiber/v3"
 	"github.com/gofiber/contrib/v3/circuitbreaker/v1"
+	"time"
 )
@@
 		FailureThreshold: 3,               // Max failures before opening the circuit
 		Timeout:          5 * time.Second, // Wait time before retrying
 		SuccessThreshold: 2,               // Required successes to move back to closed state

Also applies to: 87-89

opafiber/README.md (1)

70-73: Add missing bytes import for bytes.NewBufferString

Examples use bytes.NewBufferString but don’t import bytes.

 import (
+	"bytes"
 	"github.com/gofiber/fiber/v3"
 	"github.com/gofiber/contrib/v3/opafiber/v1"
 )
@@
 	cfg := opafiber.Config{
 		RegoQuery:             "data.example.authz.allow",
-		RegoPolicy:            bytes.NewBufferString(module),
+		RegoPolicy:            bytes.NewBufferString(module),

Also applies to: 87-90

fiberzerolog/README.md (4)

35-35: Use fully-qualified type and clearer wording for Next.

-| Next          | `func(Ctx) bool`              | Define a function to skip this middleware when returned true                                                                                                                                                                                                                                | `nil`                                                                       |
+| Next          | `func(fiber.Ctx) bool`        | Skip this middleware when it returns `true`.                                                                                                                                                                                                                                                | `nil`                                                                       |

44-44: Polish GetResBody signature formatting and description.

-| GetResBody    | func(c fiber.Ctx) []byte      | Define a function to get response body when return non-nil.<br />eg: When use compress middleware, resBody is unreadable. you can set GetResBody func to get readable resBody.                                                                                                              | `nil` |
+| GetResBody    | `func(fiber.Ctx) []byte`      | Provide a function that returns a readable response body. When non-nil is returned, it replaces the default body (e.g., with compression middleware).                                                                                                                                        | `nil` |

37-37: Return type should be pointer to match Logger field.

-| GetLogger        | `func(fiber.Ctx) zerolog.Logger`           | Get custom zerolog logger, if it's defined the returned logger will replace the `Logger` value.                                                                                                                                                                                             | `nil`                                                      |
+| GetLogger        | `func(fiber.Ctx) *zerolog.Logger`          | Return a custom zerolog logger; when set, its result replaces `Logger`.                                                                                                                                                                                                                      | `nil`                                                      |

51-55: Example won’t compile: missing os import.

 import (
+    "os"
     "github.com/gofiber/fiber/v3"
     "github.com/gofiber/contrib/v3/fiberzerolog/v1"
     "github.com/rs/zerolog"
 )
🧹 Nitpick comments (18)
fiberzap/README.md (1)

35-35: Clarify type: include package and parameter name.

Use the by-value Fiber v3 ctx with package qualifier.

-| Next       | `func(Ctx) bool`          | Define a function to skip this middleware when returned true                                                                                                                   | `nil`                                                                       |
+| Next       | `func(c fiber.Ctx) bool`   | Define a function to skip this middleware when returned true                                                                                                                   | `nil`                                                                       |
otelfiber/otelfiber_test/fiber_test.go (1)

101-102: Use time.Duration for Test timeouts (avoid 3µs).
fiber.TestConfig.Timeout is a time.Duration; 3000 is 3µs, not 3s.

@@
- resp, _ := app.Test(r, fiber.TestConfig{Timeout: 3000})
+ resp, _ := app.Test(r, fiber.TestConfig{Timeout: 3 * time.Second})
@@
- resp, _ := app.Test(httptest.NewRequest("GET", "/user/123?foo=bar", nil), fiber.TestConfig{Timeout: 3000})
+ resp, _ := app.Test(httptest.NewRequest("GET", "/user/123?foo=bar", nil), fiber.TestConfig{Timeout: 3 * time.Second})
@@
- resp, _ := app.Test(httptest.NewRequest("GET", "/foo", nil), fiber.TestConfig{Timeout: 3000})
+ resp, _ := app.Test(httptest.NewRequest("GET", "/foo", nil), fiber.TestConfig{Timeout: 3 * time.Second})
@@
- resp, _ := app.Test(req, fiber.TestConfig{Timeout: 3000})
+ resp, _ := app.Test(req, fiber.TestConfig{Timeout: 3 * time.Second})

Add missing import:

import "time"

Also applies to: 424-424, 508-509, 538-539

websocket/README.md (1)

19-22: Specify fenced code language for install block.
Helps tooling and fixes MD040.

-```
+```bash
 go get -u github.com/gofiber/fiber/v3
 go get -u github.com/gofiber/contrib/v3/websocket/v1

</blockquote></details>
<details>
<summary>monitor/README.md (1)</summary><blockquote>

`36-41`: **Fix typos and specify fenced code language.**
“montioring”/“specilt” typos; add bash to install block.


```diff
-``` 
+```bash
 go get -u github.com/gofiber/fiber/v3
 go get -u github.com/gofiber/contrib/v3/monitor/v1

@@
-| APIOnly | bool | Whether the service should expose only the montioring API. | false |
+| APIOnly | bool | Whether the service should expose only the monitoring API. | false |
@@
-| CustomHead | string | Custom HTML code to Head Section(Before End). | empty |
-| FontURL | string | FontURL for specilt font resource path or URL. also you can use relative path. | https://fonts.googleapis.com/css2?family=Roboto:wght@400;900&display=swap |
-| ChartJsURL | string | ChartJsURL for specilt chartjs library, path or URL, also you can use relative path. | https://cdn.jsdelivr.net/npm/[email protected]/dist/Chart.bundle.min.js |
+| CustomHead | string | Custom HTML code to Head section (before end). | empty |
+| FontURL | string | Font URL for special font resource path or URL; you can also use a relative path. | https://fonts.googleapis.com/css2?family=Roboto:wght@400;900&display=swap |
+| ChartJsURL | string | Chart.js URL for the library path or URL; you can also use a relative path. | https://cdn.jsdelivr.net/npm/[email protected]/dist/Chart.bundle.min.js |


</blockquote></details>
<details>
<summary>fgprof/README.md (1)</summary><blockquote>

`21-24`: **Specify fenced code language for install block.**


```diff
-```
+```bash
 go get -u github.com/gofiber/fiber/v3
 go get -u github.com/gofiber/contrib/v3/fgprof/v1

</blockquote></details>
<details>
<summary>fibersentry/README.md (1)</summary><blockquote>

`84-89`: **Replace hard tabs with spaces in code blocks**

Tabs trigger MD010; convert to spaces for consistency.

</blockquote></details>
<details>
<summary>paseto/README.md (1)</summary><blockquote>

`76-76`: **Normalize indentation to spaces**

Resolve MD010 by replacing hard tabs in these examples.



Also applies to: 174-174, 289-289

</blockquote></details>
<details>
<summary>opafiber/README.md (3)</summary><blockquote>

`19-22`: **Add language to fenced install block**

Specify bash to satisfy MD040 and improve highlighting.


```diff
-```
+```bash
 go get -u github.com/gofiber/fiber/v3
 go get -u github.com/gofiber/contrib/v3/opafiber/v1
-```
+```

94-99: Nit: remove space after func in literal

Idiomatic: func(ctx fiber.Ctx) rather than func (ctx fiber.Ctx).

-		InputCreationMethod:   func (ctx fiber.Ctx) (map[string]interface{}, error) {
+		InputCreationMethod:   func(ctx fiber.Ctx) (map[string]interface{}, error) {

72-72: Replace hard tabs with spaces

Fix MD010 in these lines.

Also applies to: 94-94

fibernewrelic/README.md (1)

19-22: Add language to fenced install block

Use bash for better readability and to satisfy MD040.

-```
+```bash
 go get -u github.com/gofiber/fiber/v3
 go get -u github.com/gofiber/contrib/v3/fibernewrelic/v1
-```
+```
fiberi18n/README.md (3)

29-30: Tighten wording in API docs (param types).

Clarify parameter types and fix grammar.

-| Localize     | `Localize(ctx fiber.Ctx, params interface{}) (string, error)` | Localize returns a localized message. param is one of these type: messageID, *i18n.LocalizeConfig                                      |                
+| Localize     | `Localize(ctx fiber.Ctx, params interface{}) (string, error)` | Localize returns a localized message. param is one of: messageID or `*i18n.LocalizeConfig`.                                            |                
-| MustLocalize | `MustLocalize(ctx fiber.Ctx, params interface{}) string`      | MustLocalize is similar to Localize, except it panics if an error happens. param is one of these type: messageID, *i18n.LocalizeConfig |  
+| MustLocalize | `MustLocalize(ctx fiber.Ctx, params interface{}) string`      | Like Localize, but panics on error. param is one of: messageID or `*i18n.LocalizeConfig`.                                              |  

36-36: Polish “Next” description.

Minor grammar improvement.

-| Next             | `func(c fiber.Ctx) bool`                         | A function to skip this middleware when returned `true`.                                                                           | `nil`                                                                          |
+| Next             | `func(c fiber.Ctx) bool`                         | Skip this middleware when it returns `true`.                                                                                       | `nil`                                                                          |

44-44: Clarify LangHandler behavior.

Make the fallback explicit and remove awkward phrasing.

-| LangHandler      | `func(ctx fiber.Ctx, defaultLang string) string` | Used to get the kind of language handled by fiber.Ctx and defaultLang.                                                            | Retrieved from the request header `Accept-Language` or query parameter `lang`. |
+| LangHandler      | `func(ctx fiber.Ctx, defaultLang string) string` | Resolve language from `ctx`; falls back to `defaultLang` when none is found.                                                     | Retrieved from the request header `Accept-Language` or query parameter `lang`. |
loadshed/README.md (2)

117-117: Polish “Next” description.

-| Next     | `func(fiber.Ctx) bool`    | Function to skip this middleware when returned true.    | `nil`                   |
+| Next     | `func(fiber.Ctx) bool`    | Skip this middleware when it returns true.              | `nil`                   |

119-119: Minor: unify parameter name usage.

Use ctx consistently to match examples.

-| OnShed   | `func(c fiber.Ctx) error` | Function to be executed if a request should be declined | `nil`                   |
+| OnShed   | `func(ctx fiber.Ctx) error` | Function to execute when a request is declined          | `nil`                   |
casbin/README.md (1)

39-41: Tighten config callback descriptions and match style.

-| Lookup        | `func(fiber.Ctx) string` | Look up for current subject              | `""`                                                                |
-| Unauthorized  | `func(fiber.Ctx) error`  | Response body for unauthorized responses | `Unauthorized`                                                      |
-| Forbidden     | `func(fiber.Ctx) error`  | Response body for forbidden responses    | `Forbidden`                                                         |
+| Lookup        | `func(fiber.Ctx) string` | Lookup the current subject               | `""`                                                                |
+| Unauthorized  | `func(fiber.Ctx) error`  | Handler for unauthorized responses       | `Unauthorized`                                                      |
+| Forbidden     | `func(fiber.Ctx) error`  | Handler for forbidden responses          | `Forbidden`                                                         |
otelfiber/README.md (1)

37-37: Polish “WithNext” description spacing/grammar.

-| `WithNext`                    | `func(fiber.Ctx) bool`         | Define a function to skip this middleware when returned true .| nil                                                                 |
+| `WithNext`                    | `func(fiber.Ctx) bool`         | Skip this middleware when it returns `true`.                           | nil                                                                 |
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between c538130 and 9308ac6.

⛔ Files ignored due to path filters (22)
  • casbin/go.mod is excluded by !**/*.mod
  • circuitbreaker/go.mod is excluded by !**/*.mod
  • fgprof/go.mod is excluded by !**/*.mod
  • fiberi18n/go.mod is excluded by !**/*.mod
  • fibernewrelic/go.mod is excluded by !**/*.mod
  • fibersentry/go.mod is excluded by !**/*.mod
  • fiberzap/go.mod is excluded by !**/*.mod
  • fiberzerolog/go.mod is excluded by !**/*.mod
  • hcaptcha/go.mod is excluded by !**/*.mod
  • jwt/go.mod is excluded by !**/*.mod
  • loadshed/go.mod is excluded by !**/*.mod
  • monitor/go.mod is excluded by !**/*.mod
  • opafiber/go.mod is excluded by !**/*.mod
  • otelfiber/example/go.mod is excluded by !**/*.mod
  • otelfiber/example/go.sum is excluded by !**/*.sum, !**/*.sum
  • otelfiber/go.mod is excluded by !**/*.mod
  • paseto/go.mod is excluded by !**/*.mod
  • socketio/go.mod is excluded by !**/*.mod
  • socketio/go.sum is excluded by !**/*.sum, !**/*.sum
  • swagger/go.mod is excluded by !**/*.mod
  • testcontainers/go.mod is excluded by !**/*.mod
  • websocket/go.mod is excluded by !**/*.mod
📒 Files selected for processing (29)
  • casbin/README.md (8 hunks)
  • circuitbreaker/README.md (10 hunks)
  • fgprof/README.md (2 hunks)
  • fiberi18n/README.md (3 hunks)
  • fiberi18n/example/main.go (1 hunks)
  • fibernewrelic/README.md (5 hunks)
  • fibersentry/README.md (5 hunks)
  • fiberzap/README.md (6 hunks)
  • fiberzerolog/README.md (4 hunks)
  • hcaptcha/README.md (3 hunks)
  • jwt/README.md (4 hunks)
  • jwt/jwt_test.go (1 hunks)
  • loadshed/README.md (7 hunks)
  • monitor/README.md (3 hunks)
  • opafiber/README.md (5 hunks)
  • otelfiber/README.md (4 hunks)
  • otelfiber/doc.go (1 hunks)
  • otelfiber/example/server.go (1 hunks)
  • otelfiber/fiber.go (2 hunks)
  • otelfiber/otelfiber_test/fiber_test.go (2 hunks)
  • paseto/README.md (5 hunks)
  • socketio/README.md (4 hunks)
  • socketio/socketio.go (1 hunks)
  • socketio/socketio_test.go (1 hunks)
  • swagger/README.md (2 hunks)
  • testcontainers/README.md (4 hunks)
  • testcontainers/examples_test.go (1 hunks)
  • testcontainers/testcontainers_test.go (1 hunks)
  • websocket/README.md (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (13)
  • otelfiber/example/server.go
  • jwt/README.md
  • socketio/socketio.go
  • otelfiber/fiber.go
  • socketio/socketio_test.go
  • testcontainers/README.md
  • testcontainers/examples_test.go
  • hcaptcha/README.md
  • otelfiber/doc.go
  • fiberi18n/example/main.go
  • jwt/jwt_test.go
  • socketio/README.md
  • testcontainers/testcontainers_test.go
🧰 Additional context used
🧠 Learnings (12)
📓 Common learnings
Learnt from: ReneWerner87
PR: gofiber/fiber#3161
File: app.go:923-932
Timestamp: 2024-11-15T07:56:21.623Z
Learning: In the Fiber framework, breaking changes are acceptable when moving from version 2 to version 3, including modifications to method signatures such as in the `Test` method in `app.go`.
Learnt from: ReneWerner87
PR: gofiber/contrib#0
File: :0-0
Timestamp: 2024-11-21T11:28:14.554Z
Learning: Using `fiber.Ctx`, even when wrapped, does not achieve version independence, as it still relies on the specific Fiber implementation.
Learnt from: sixcolors
PR: gofiber/fiber#3446
File: docs/middleware/logger.md:44-44
Timestamp: 2025-05-13T00:19:16.407Z
Learning: In documentation files for the Fiber framework, code examples are often partial and don't repeat import statements that were shown in earlier examples, focusing instead on demonstrating specific usage patterns.
📚 Learning: 2024-11-15T07:56:21.623Z
Learnt from: ReneWerner87
PR: gofiber/fiber#3161
File: app.go:923-932
Timestamp: 2024-11-15T07:56:21.623Z
Learning: In the Fiber framework, breaking changes are acceptable when moving from version 2 to version 3, including modifications to method signatures such as in the `Test` method in `app.go`.

Applied to files:

  • otelfiber/otelfiber_test/fiber_test.go
  • opafiber/README.md
  • fibernewrelic/README.md
  • circuitbreaker/README.md
  • otelfiber/README.md
  • fiberzerolog/README.md
  • fiberzap/README.md
  • casbin/README.md
  • fiberi18n/README.md
  • fibersentry/README.md
  • websocket/README.md
📚 Learning: 2024-10-08T19:06:06.583Z
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/store.go:164-167
Timestamp: 2024-10-08T19:06:06.583Z
Learning: Unit tests in this project use testify require.

Applied to files:

  • otelfiber/otelfiber_test/fiber_test.go
📚 Learning: 2024-07-26T21:00:12.902Z
Learnt from: sixcolors
PR: gofiber/fiber#2922
File: middleware/cors/utils.go:63-71
Timestamp: 2024-07-26T21:00:12.902Z
Learning: The project uses the testify/assert package for assertions in unit tests.

Applied to files:

  • otelfiber/otelfiber_test/fiber_test.go
📚 Learning: 2024-12-13T08:14:22.851Z
Learnt from: efectn
PR: gofiber/fiber#3162
File: hooks_test.go:228-228
Timestamp: 2024-12-13T08:14:22.851Z
Learning: In Go test files, prefer using the `require` methods from the `testify` package for assertions instead of manual comparisons and calls to `t.Fatal` or `t.Fatalf`.

Applied to files:

  • otelfiber/otelfiber_test/fiber_test.go
📚 Learning: 2024-11-10T23:44:13.704Z
Learnt from: gaby
PR: gofiber/fiber#3193
File: middleware/adaptor/adaptor.go:111-111
Timestamp: 2024-11-10T23:44:13.704Z
Learning: In the `middleware/adaptor/adaptor.go` file of the Fiber framework, when updating context handling, replacing `c.Context()` with `c.RequestCtx()` is appropriate to access the `fasthttp.RequestCtx`.

Applied to files:

  • opafiber/README.md
  • fiberzerolog/README.md
  • fiberzap/README.md
  • fibersentry/README.md
📚 Learning: 2024-11-23T19:50:41.765Z
Learnt from: norri
PR: gofiber/recipes#2701
File: clean-code/app/server/server.go:14-16
Timestamp: 2024-11-23T19:50:41.765Z
Learning: In the `clean-code` example at `clean-code/app/server/server.go` using the Go Fiber framework, it's acceptable to omit production-level features like context usage and graceful shutdown handling to keep the example simple.

Applied to files:

  • fibernewrelic/README.md
  • fiberzap/README.md
  • fgprof/README.md
📚 Learning: 2024-10-08T19:06:06.583Z
Learnt from: sixcolors
PR: gofiber/fiber#3016
File: middleware/session/config.go:122-122
Timestamp: 2024-10-08T19:06:06.583Z
Learning: In `DefaultErrorHandler(c *fiber.Ctx, err error)`, since `c` is a pointer to an interface, we need to dereference `*c` when calling interface methods like `SendStatus`.

Applied to files:

  • otelfiber/README.md
📚 Learning: 2024-11-08T04:10:42.990Z
Learnt from: gaby
PR: gofiber/fiber#3193
File: middleware/cache/cache_test.go:897-897
Timestamp: 2024-11-08T04:10:42.990Z
Learning: In the Fiber framework, `Context()` is being renamed to `RequestCtx()`, and `UserContext()` to `Context()` to improve clarity and align with Go's context conventions.

Applied to files:

  • fiberzerolog/README.md
  • fiberzap/README.md
📚 Learning: 2024-11-29T15:24:06.083Z
Learnt from: ReneWerner87
PR: gofiber/contrib#0
File: :0-0
Timestamp: 2024-11-29T15:24:06.083Z
Learning: When customizing the Fiber context to achieve version independence, using generics in methods like `Status` and `Type` allows for fluent method chaining. Implementing a generic interface for `Ctx` on the `App` prevents class switching when registering custom contexts that use fluent methods. Providing multiple `New` methods allows users who do not wish to customize the context to continue using `fiber.New` without changes.

Applied to files:

  • fiberzap/README.md
📚 Learning: 2024-11-21T11:28:14.554Z
Learnt from: ReneWerner87
PR: gofiber/contrib#0
File: :0-0
Timestamp: 2024-11-21T11:28:14.554Z
Learning: Using `fiber.Ctx`, even when wrapped, does not achieve version independence, as it still relies on the specific Fiber implementation.

Applied to files:

  • fiberzap/README.md
📚 Learning: 2024-07-03T11:59:00.303Z
Learnt from: ReneWerner87
PR: gofiber/contrib#0
File: :0-0
Timestamp: 2024-07-03T11:59:00.303Z
Learning: The i18n functionality in the gofiber/contrib repository is being refactored from middleware to a global container to improve robustness and performance. The global container will be initialized once before setting up routes and will manage the i18n bundle and localizer map.

Applied to files:

  • fiberi18n/README.md
🪛 markdownlint-cli2 (0.17.2)
paseto/README.md

76-76: Hard tabs
Column: 1

(MD010, no-hard-tabs)


174-174: Hard tabs
Column: 1

(MD010, no-hard-tabs)


289-289: Hard tabs
Column: 1

(MD010, no-hard-tabs)

opafiber/README.md

15-15: Emphasis used instead of a heading

(MD036, no-emphasis-as-heading)


21-21: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


72-72: Hard tabs
Column: 1

(MD010, no-hard-tabs)


94-94: Hard tabs
Column: 1

(MD010, no-hard-tabs)

fibernewrelic/README.md

19-19: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

otelfiber/README.md

66-66: Hard tabs
Column: 1

(MD010, no-hard-tabs)


92-92: Hard tabs
Column: 1

(MD010, no-hard-tabs)


93-93: Hard tabs
Column: 1

(MD010, no-hard-tabs)


94-94: Hard tabs
Column: 1

(MD010, no-hard-tabs)


96-96: Hard tabs
Column: 1

(MD010, no-hard-tabs)

fiberzap/README.md

98-98: Hard tabs
Column: 1

(MD010, no-hard-tabs)

casbin/README.md

18-18: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

fiberi18n/README.md

70-70: Hard tabs
Column: 1

(MD010, no-hard-tabs)

fibersentry/README.md

55-55: Hard tabs
Column: 1

(MD010, no-hard-tabs)


65-65: Hard tabs
Column: 1

(MD010, no-hard-tabs)


84-84: Hard tabs
Column: 1

(MD010, no-hard-tabs)


85-85: Hard tabs
Column: 1

(MD010, no-hard-tabs)


86-86: Hard tabs
Column: 1

(MD010, no-hard-tabs)


87-87: Hard tabs
Column: 1

(MD010, no-hard-tabs)


88-88: Hard tabs
Column: 1

(MD010, no-hard-tabs)


89-89: Hard tabs
Column: 1

(MD010, no-hard-tabs)


91-91: Hard tabs
Column: 1

(MD010, no-hard-tabs)


92-92: Hard tabs
Column: 1

(MD010, no-hard-tabs)


93-93: Hard tabs
Column: 1

(MD010, no-hard-tabs)


95-95: Hard tabs
Column: 1

(MD010, no-hard-tabs)


116-116: Hard tabs
Column: 1

(MD010, no-hard-tabs)

monitor/README.md

51-51: Hard tabs
Column: 1

(MD010, no-hard-tabs)

swagger/README.md

104-104: Hard tabs
Column: 1

(MD010, no-hard-tabs)

websocket/README.md

19-19: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


53-53: Hard tabs
Column: 1

(MD010, no-hard-tabs)

🪛 LanguageTool
otelfiber/README.md

[grammar] ~37-~37: There might be a mistake here.
Context: ... | | WithTracerProvider | `otelt...

(QB_NEW_EN)


[grammar] ~38-~38: There might be a mistake here.
Context: ...used | | WithMeterProvider | `otelm...

(QB_NEW_EN)


[grammar] ~39-~39: There might be a mistake here.
Context: ... | | WithPort | int ...

(QB_NEW_EN)


[grammar] ~41-~41: There might be a mistake here.
Context: ...he HTTP requests. | If none are specified, global ones will be used | | (❌ Removed) WithServerName ...

(QB_NEW_EN)


[grammar] ~45-~45: There might be a mistake here.
Context: ...ributes to the metrics. | nil | | WithCollectClientIP | bool ...

(QB_NEW_EN)

fiberzerolog/README.md

[grammar] ~42-~42: There might be a mistake here.
Context: ...zerolog.WarnLevel, zerolog.InfoLevel}| | SkipURIs |[]string` ...

(QB_NEW_EN)


[grammar] ~43-~43: There might be a mistake here.
Context: ... | | GetResBody | func(c fiber.Ctx) []by...

(QB_NEW_EN)


[grammar] ~44-~44: There might be a mistake here.
Context: ...Ctx) []byte | Define a function to get response body when return non-nil.<br /...

(QB_NEW_EN)


[grammar] ~44-~44: There might be a mistake here.
Context: ...eadable. you can set GetResBody func to get readable resBody. ...

(QB_NEW_EN)

fiberzap/README.md

[grammar] ~36-~36: There might be a mistake here.
Context: ... | | Fields | []string ...

(QB_NEW_EN)


[grammar] ~37-~37: Ensure spelling is correct
Context: ...[]string | Add fields what you want see. ...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~40-~40: There might be a mistake here.
Context: ...zapcore.WarnLevel, zapcore.InfoLevel}| | SkipURIs |[]string` ...

(QB_NEW_EN)


[grammar] ~42-~42: There might be a mistake here.
Context: ...iber.Ctx) []byte | Define a function to get response body when return non-nil.<br /...

(QB_NEW_EN)


[grammar] ~42-~42: There might be a mistake here.
Context: ...eadable. you can set GetResBody func to get readable resBody. | nil ...

(QB_NEW_EN)

casbin/README.md

[grammar] ~40-~40: There might be a mistake here.
Context: ... | | Forbidden | `func(fiber.Ctx) error...

(QB_NEW_EN)

fgprof/README.md

[grammar] ~30-~30: There might be a mistake here.
Context: ... | nil | | Prefix | string. | ...

(QB_NEW_EN)

fiberi18n/README.md

[grammar] ~36-~36: There might be a mistake here.
Context: ... | | RootPath | string ...

(QB_NEW_EN)

loadshed/README.md

[grammar] ~117-~117: There might be a mistake here.
Context: ...ned true. | nil | | Criteria | LoadCriteria ...

(QB_NEW_EN)


[grammar] ~118-~118: There might be a mistake here.
Context: ...ia. | &CPULoadCriteria{...} | | OnShed | func(c fiber.Ctx) error |...

(QB_NEW_EN)

swagger/README.md

[grammar] ~38-~38: There might be a mistake here.
Context: .../contrib/v3/swagger/v1 ### Examples Import the middleware packagego impo...

(QB_NEW_EN)

🔇 Additional comments (14)
otelfiber/otelfiber_test/fiber_test.go (2)

11-11: Import path bump to v3/v1 looks correct.


31-31: Instrumentation name updated to v3 path — OK.
Matches the expected tracer/meter scope for this module.

websocket/README.md (3)

15-16: Add v3 compatibility note — looks good.


21-22: Install path updated to contrib/v3/websocket/v1 — OK.


53-54: Example import path updated — OK.

monitor/README.md (1)

21-22: Install path updated to contrib/v3/monitor/v1 — OK.

swagger/README.md (3)

35-35: Install path updated to contrib/v3/swagger/v1 — OK.


43-43: Example import path updated — OK.


104-105: Next signature switched to by-value fiber.Ctx — OK.
Matches the v3 migration.

fgprof/README.md (4)

23-24: Install path updated to contrib/v3/fgprof/v1 — OK.


30-30: Next signature switched to by-value fiber.Ctx — OK.


41-42: Example import path updated — OK.


48-49: Example handler updated to by-value fiber.Ctx — OK.

fibernewrelic/README.md (1)

21-21: Module path looks correct for v3 layout

v1 submodule is published; install line is good.

| Refresh | `time.Duration` | Refresh period. | `3 seconds` |
| APIOnly | `bool` | Whether the service should expose only the montioring API. | `false` |
| Next | `func(c *fiber.Ctx) bool` | Define a function to add custom fields. | `nil` |
| Next | `func(c fiber.Ctx) bool` | Define a function to add custom fields. | `nil` |
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Correct Next description (it’s a skipper).
Current text says “add custom fields,” which is misleading.

-| Next       | `func(c fiber.Ctx) bool` | Define a function to add custom fields.                                              | `nil`                                                                       |
+| Next       | `func(c fiber.Ctx) bool` | Defines a function to skip this middleware when it returns `true`.                   | `nil`                                                                       |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| Next | `func(c fiber.Ctx) bool` | Define a function to add custom fields. | `nil` |
| Next | `func(c fiber.Ctx) bool` | Defines a function to skip this middleware when it returns `true`. | `nil` |
🤖 Prompt for AI Agents
In monitor/README.md around line 37, the table's "Next" column description is
incorrect: it currently says "Define a function to add custom fields" but should
describe the skipper behavior; update the text to indicate that Next is a
skipper function of signature func(c fiber.Ctx) bool (i.e., a function that
determines whether to skip the middleware for a given request) and replace the
misleading phrase with something like "Skipper: return true to skip this
middleware for the request."

app.Get("/users/:id", func(c fiber.Ctx) error {
id := c.Params("id")
name := getUser(c.UserContext(), id)
return c.JSON(fiber.Map{"id": id, name: name})
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix example JSON map: missing quotes around key.

This won’t compile as written.

-        return c.JSON(fiber.Map{"id": id, name: name})
+        return c.JSON(fiber.Map{"id": id, "name": name})
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return c.JSON(fiber.Map{"id": id, name: name})
return c.JSON(fiber.Map{"id": id, "name": name})
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

99-99: Hard tabs
Column: 1

(MD010, no-hard-tabs)

🤖 Prompt for AI Agents
In otelfiber/README.md around line 99, the JSON map literal is invalid because
the key name is unquoted; update the map to use quoted keys (e.g., quote "name")
so the map compiles correctly when returning c.JSON(fiber.Map{...}).

Comment on lines +40 to 41
| Next | `func(Ctx) bool` | Defines a function to skip middleware | `nil` |
| SuccessHandler | `func(fiber.Ctx) error` | SuccessHandler defines a function which is executed for a valid token. | `c.Next()` |
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Correct Next type to include package qualifier

Use fiber.Ctx to match the rest of the docs and signatures.

-| Next           | `func(Ctx) bool`               | Defines a function to skip middleware                                                                                                   | `nil`                           |
+| Next           | `func(fiber.Ctx) bool`         | Defines a function to skip middleware                                                                                                   | `nil`                           |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| Next | `func(Ctx) bool` | Defines a function to skip middleware | `nil` |
| SuccessHandler | `func(fiber.Ctx) error` | SuccessHandler defines a function which is executed for a valid token. | `c.Next()` |
| Next | `func(fiber.Ctx) bool` | Defines a function to skip middleware | `nil` |
🤖 Prompt for AI Agents
In paseto/README.md around lines 40 to 41, the table's Next type is incorrectly
listed as `func(Ctx) bool`; update it to use the package-qualified type
`func(fiber.Ctx) bool` to match the rest of the documentation and function
signatures, ensuring consistency with the `SuccessHandler` entry and other
references to `fiber.Ctx`.

@ReneWerner87
Copy link
Member Author

Replaced by #1427

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants