Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions docs/middleware/requestid.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ id: requestid

# RequestID

RequestID middleware for [Fiber](https://github.com/gofiber/fiber) that adds an identifier to the response.
RequestID middleware for [Fiber](https://github.com/gofiber/fiber) that generates or propagates a request identifier. The ID is added to the response headers and stored in the request context.

## Signatures

Expand All @@ -24,7 +24,7 @@ import (
)
```

After you initiate your Fiber app, you can use the following possibilities:
After initializing your Fiber app, you can use the middleware in the following ways:

```go
// Initialize default config
Expand All @@ -39,6 +39,8 @@ app.Use(requestid.New(requestid.Config{
}))
```

If the incoming request already contains the configured header, its value is reused instead of generating a new one.
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

While this clarification is a great addition, it could be even more helpful by being more explicit. Mentioning the specific configuration option (Config.Header), its default value, and the alternative behavior (generation) would make the documentation more self-contained and clearer for the user.

Suggested change
If the incoming request already contains the configured header, its value is reused instead of generating a new one.
If the header (configured in `Config.Header`, defaulting to `X-Request-ID`) is already present in the incoming request, its value is reused. Otherwise, a new ID is generated.


Getting the request ID

```go
Expand Down