Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
f416b9a
link: Web Incubator Community Group (WICG)
jsoref Oct 21, 2025
f909857
spelling: ; otherwise,
jsoref Oct 21, 2025
f7460d1
spelling: a key, the value
jsoref Oct 21, 2025
06f420c
spelling: a
jsoref Oct 21, 2025
5a5bdde
spelling: before returning
jsoref Oct 21, 2025
6fc2b4f
spelling: beginning
jsoref Oct 21, 2025
d781e09
spelling: bound
jsoref Oct 21, 2025
3d79ef9
spelling: case-insensitive
jsoref Oct 21, 2025
c2c31e5
spelling: case-sensitive
jsoref Oct 21, 2025
cb913cb
spelling: circle
jsoref Oct 21, 2025
391f593
spelling: defines methods
jsoref Oct 21, 2025
bd41d99
spelling: fall back
jsoref Oct 21, 2025
e16d1c6
spelling: fallback
jsoref Oct 21, 2025
7d97b48
spelling: github
jsoref Oct 21, 2025
eeb1f57
spelling: if there is no value for the key
jsoref Oct 21, 2025
e3e64df
spelling: if
jsoref Oct 21, 2025
2b6394e
spelling: its
jsoref Oct 21, 2025
37f7bf2
spelling: longest
jsoref Oct 21, 2025
e8e3547
spelling: nonexistent
jsoref Oct 21, 2025
ae87258
spelling: or fall back
jsoref Oct 21, 2025
12a52a6
spelling: otherwise,
jsoref Oct 21, 2025
de3d9ce
spelling: partial
jsoref Oct 21, 2025
3464094
spelling: pre-shutdown
jsoref Oct 21, 2025
7e0a5e9
spelling: prepopulate
jsoref Oct 21, 2025
41f6a99
spelling: preshutdown
jsoref Oct 21, 2025
ae45770
spelling: repeated
jsoref Oct 21, 2025
d228ad8
spelling: set up
jsoref Oct 21, 2025
00f4259
spelling: soccer
jsoref Oct 21, 2025
c42a544
spelling: spoofing if your app is behind a
jsoref Oct 21, 2025
14f5513
spelling: sub-origins
jsoref Oct 21, 2025
a05398c
spelling: there is
jsoref Oct 21, 2025
906ab27
spelling: when
jsoref Oct 21, 2025
7e70ca2
reword: when neither/nor...
jsoref Oct 21, 2025
cb5c28e
spelling: sometimes, the id is not equal to a
jsoref Oct 21, 2025
4a5290b
Merge branch 'main' into spelling
sixcolors Oct 22, 2025
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
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Agent Instructions

> **Note for the AI agent:** Before running the startup script, verify that all dependencies and CLI tools are already available. If a `vendor/` directory exists **or** `go list -m -mod=readonly all` succeeds (indicating modules are cached), you may skip the entire startup script—including all `go mod` commands and `go install` steps. Otherwise run the script as listed below.
> **Note for the AI agent:** Before running the startup script, verify that all dependencies and CLI tools are already available. If a `vendor/` directory exists **or** `go list -m -mod=readonly all` succeeds (indicating modules are cached), you may skip the entire startup script—including all `go mod` commands and `go install` steps. Otherwise, run the script as listed below.

---

Expand Down
10 changes: 5 additions & 5 deletions app.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ⚡️ Fiber is an Express inspired web framework written in Go with ☕️
// 🤖 Github Repository: https://github.com/gofiber/fiber
// 🤖 GitHub Repository: https://github.com/gofiber/fiber
// 📌 API Documentation: https://docs.gofiber.io

// Package fiber is an Express inspired web framework built on top of Fasthttp,
Expand Down Expand Up @@ -637,7 +637,7 @@ func NewWithCustomCtx(newCtxFunc func(app *App) CustomCtx, config ...Config) *Ap
}

// GetString returns s unchanged when Immutable is off or s is read-only (rodata).
// Otherwise it returns a detached copy (strings.Clone).
// Otherwise, it returns a detached copy (strings.Clone).
func (app *App) GetString(s string) string {
if !app.config.Immutable || len(s) == 0 {
return s
Expand All @@ -649,7 +649,7 @@ func (app *App) GetString(s string) string {
}

// GetBytes returns b unchanged when Immutable is off or b is read-only (rodata).
// Otherwise it returns a detached copy.
// Otherwise, it returns a detached copy.
func (app *App) GetBytes(b []byte) []byte {
if !app.config.Immutable || len(b) == 0 {
return b
Expand Down Expand Up @@ -1015,7 +1015,7 @@ func (app *App) HandlersCount() uint32 {
//
// Make sure the program doesn't exit and waits instead for Shutdown to return.
//
// Important: app.Listen() must be called in a separate goroutine, otherwise shutdown hooks will not work
// Important: app.Listen() must be called in a separate goroutine; otherwise, shutdown hooks will not work
// as Listen() is a blocking operation. Example:
//
// go app.Listen(":3000")
Expand Down Expand Up @@ -1263,7 +1263,7 @@ func (app *App) init() *App {
// ErrorHandler is the application's method in charge of finding the
// appropriate handler for the given request. It searches any mounted
// sub fibers by their prefixes and if it finds a match, it uses that
// error handler. Otherwise it uses the configured error handler for
// error handler. Otherwise, it uses the configured error handler for
// the app, which if not set is the DefaultErrorHandler.
func (app *App) ErrorHandler(ctx Ctx, err error) error {
var (
Expand Down
6 changes: 3 additions & 3 deletions app_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ⚡️ Fiber is an Express inspired web framework written in Go with ☕️
// 🤖 Github Repository: https://github.com/gofiber/fiber
// 🤖 GitHub Repository: https://github.com/gofiber/fiber
// 📌 API Documentation: https://docs.gofiber.io

package fiber
Expand Down Expand Up @@ -530,7 +530,7 @@ func Test_App_ErrorHandler_Custom(t *testing.T) {
t.Parallel()
app := New(Config{
ErrorHandler: func(c Ctx, _ error) error {
return c.Status(200).SendString("hi, i'm an custom error")
return c.Status(200).SendString("hi, i'm a custom error")
},
})

Expand All @@ -544,7 +544,7 @@ func Test_App_ErrorHandler_Custom(t *testing.T) {

body, err := io.ReadAll(resp.Body)
require.NoError(t, err)
require.Equal(t, "hi, i'm an custom error", string(body))
require.Equal(t, "hi, i'm a custom error", string(body))
}

func Test_App_ErrorHandler_HandlerStack(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions bind.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (b *Bind) RespHeader(out any) error {
}

// Cookie binds the request cookie strings into the struct, map[string]string and map[string][]string.
// NOTE: If your cookie is like key=val1,val2; they'll be binded as an slice if your map is map[string][]string. Else, it'll use last element of cookie.
// NOTE: If your cookie is like key=val1,val2; they'll be bound as a slice if your map is map[string][]string. Else, it'll use last element of cookie.
func (b *Bind) Cookie(out any) error {
bind := binder.GetFromThePool[*binder.CookieBinding](&binder.CookieBinderPool)
bind.EnableSplitting = b.ctx.App().config.EnableSplittingOnParsers
Expand Down Expand Up @@ -299,7 +299,7 @@ func (b *Bind) MsgPack(out any) error {
// It supports decoding the following content types based on the Content-Type header:
// application/json, application/xml, application/x-www-form-urlencoded, multipart/form-data
// If none of the content types above are matched, it'll take a look custom binders by checking the MIMETypes() method of custom binder.
// If there're no custom binder for mime type of body, it will return a ErrUnprocessableEntity error.
// If there is no custom binder for mime type of body, it will return a ErrUnprocessableEntity error.
func (b *Bind) Body(out any) error {
// Get content-type
ctype := utils.ToLower(utils.UnsafeString(b.ctx.RequestCtx().Request.Header.ContentType()))
Expand Down
6 changes: 3 additions & 3 deletions bind_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func Test_Bind_Query(t *testing.T) {
require.NoError(t, c.Bind().Query(q))
require.Len(t, q.Hobby, 2)

c.Request().URI().SetQueryString("id=1&name=tom&hobby=scoccer&hobby=basketball,football")
c.Request().URI().SetQueryString("id=1&name=tom&hobby=soccer&hobby=basketball,football")
q = new(Query)
require.NoError(t, c.Bind().Query(q))
require.Len(t, q.Hobby, 3)
Expand Down Expand Up @@ -148,12 +148,12 @@ func Test_Bind_Query_Map(t *testing.T) {
require.NoError(t, c.Bind().Query(&q))
require.Len(t, q["hobby"], 2)

c.Request().URI().SetQueryString("id=1&name=tom&hobby=scoccer&hobby=basketball,football")
c.Request().URI().SetQueryString("id=1&name=tom&hobby=soccer&hobby=basketball,football")
q = make(map[string][]string)
require.NoError(t, c.Bind().Query(&q))
require.Len(t, q["hobby"], 3)

c.Request().URI().SetQueryString("id=1&name=tom&hobby=scoccer")
c.Request().URI().SetQueryString("id=1&name=tom&hobby=soccer")
qq := make(map[string]string)
require.NoError(t, c.Bind().Query(&qq))
require.Equal(t, "1", qq["id"])
Expand Down
2 changes: 1 addition & 1 deletion client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1338,7 +1338,7 @@ func Test_Client_Header(t *testing.T) {
require.Equal(t, "foo", res[0])
})

t.Run("set header case insensitive", func(t *testing.T) {
t.Run("set header case-insensitive", func(t *testing.T) {
t.Parallel()
req := New()
req.SetHeader("foo", "bar").
Expand Down
6 changes: 3 additions & 3 deletions client/hooks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ func Test_Parser_Request_Header(t *testing.T) {
req := AcquireRequest().
SetFormDataWithMap(map[string]string{
"foo": "bar",
"ball": "cricle and square",
"ball": "circle and square",
})

err := parserRequestHeader(client, req)
Expand Down Expand Up @@ -531,12 +531,12 @@ func Test_Parser_Request_Body(t *testing.T) {
client := New()
req := AcquireRequest().
SetFormDataWithMap(map[string]string{
"ball": "cricle and square",
"ball": "circle and square",
})

err := parserRequestBody(client, req)
require.NoError(t, err)
require.Equal(t, "ball=cricle+and+square", string(req.RawRequest.Body()))
require.Equal(t, "ball=circle+and+square", string(req.RawRequest.Body()))
})

t.Run("form data body error", func(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion color.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ⚡️ Fiber is an Express inspired web framework written in Go with ☕️
// 🤖 Github Repository: https://github.com/gofiber/fiber
// 🤖 GitHub Repository: https://github.com/gofiber/fiber
// 📌 API Documentation: https://docs.gofiber.io

package fiber
Expand Down
2 changes: 1 addition & 1 deletion ctx.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ⚡️ Fiber is an Express inspired web framework written in Go with ☕️
// 🤖 Github Repository: https://github.com/gofiber/fiber
// 🤖 GitHub Repository: https://github.com/gofiber/fiber
// 📌 API Documentation: https://docs.gofiber.io

package fiber
Expand Down
2 changes: 1 addition & 1 deletion ctx_interface.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ⚡️ Fiber is an Express inspired web framework written in Go with ☕️
// 🤖 Github Repository: https://github.com/gofiber/fiber
// 🤖 GitHub Repository: https://github.com/gofiber/fiber
// 📌 API Documentation: https://docs.gofiber.io

package fiber
Expand Down
12 changes: 6 additions & 6 deletions ctx_interface_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions ctx_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ⚡️ Fiber is an Express inspired web framework written in Go with ☕️
// 🤖 Github Repository: https://github.com/gofiber/fiber
// 🤖 GitHub Repository: https://github.com/gofiber/fiber
// 📌 API Documentation: https://docs.gofiber.io

package fiber
Expand Down Expand Up @@ -3307,7 +3307,7 @@ func Test_Ctx_Path(t *testing.T) {
app.Get("/test/:user", func(c Ctx) error {
require.Equal(t, "/Test/John", c.Path())
require.Equal(t, "/Test/John", string(c.Request().URI().Path()))
// not strict && case insensitive
// not strict && case-insensitive
require.Equal(t, "/ABC/", c.Path("/ABC/"))
require.Equal(t, "/ABC/", string(c.Request().URI().Path()))
require.Equal(t, "/test/john/", c.Path("/test/john/"))
Expand Down Expand Up @@ -5583,7 +5583,7 @@ func Benchmark_Ctx_Get_Location_From_Route(b *testing.B) {
func Test_Ctx_Get_Location_From_Route_name(t *testing.T) {
t.Parallel()

t.Run("case insensitive", func(t *testing.T) {
t.Run("case-insensitive", func(t *testing.T) {
t.Parallel()
app := New()
c := app.AcquireCtx(&fasthttp.RequestCtx{})
Expand All @@ -5600,7 +5600,7 @@ func Test_Ctx_Get_Location_From_Route_name(t *testing.T) {
require.Equal(t, "/user/fiber", location)
})

t.Run("case sensitive", func(t *testing.T) {
t.Run("case-sensitive", func(t *testing.T) {
t.Parallel()
app := New(Config{CaseSensitive: true})
c := app.AcquireCtx(&fasthttp.RequestCtx{})
Expand Down
4 changes: 2 additions & 2 deletions docs/api/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import Reference from '@site/src/components/reference';

### GetString

Returns `s` unchanged when [`Immutable`](./fiber.md#immutable) is disabled or `s` resides in read-only memory. Otherwise it returns a detached copy using `strings.Clone`.
Returns `s` unchanged when [`Immutable`](./fiber.md#immutable) is disabled or `s` resides in read-only memory. Otherwise, it returns a detached copy using `strings.Clone`.

```go title="Signature"
func (app *App) GetString(s string) string
```

### GetBytes

Returns `b` unchanged when [`Immutable`](./fiber.md#immutable) is disabled or `b` resides in read-only memory. Otherwise it returns a detached copy.
Returns `b` unchanged when [`Immutable`](./fiber.md#immutable) is disabled or `b` resides in read-only memory. Otherwise, it returns a detached copy.

```go title="Signature"
func (app *App) GetBytes(b []byte) []byte
Expand Down
2 changes: 1 addition & 1 deletion docs/api/ctx.md
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ Make copies or use the [**`Immutable`**](./fiber.md#immutable) setting instead.

### Fresh

When the response is still **fresh** in the client's cache **true** is returned, otherwise **false** is returned to indicate that the client cache is now stale and the full response should be sent.
When the response is still **fresh** in the client's cache **true** is returned; otherwise, **false** is returned to indicate that the client cache is now stale and the full response should be sent.

When a client sends the Cache-Control: no-cache request header to indicate an end-to-end reload request, `Fresh` will return false to make handling these requests transparent.

Expand Down
2 changes: 1 addition & 1 deletion docs/api/services.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ After adding a service to the app configuration, Fiber starts it on launch and s

## Service Interface

The `Service` interface defines the methods a service must implement.
The `Service` interface defines methods a service must implement.

### Definition

Expand Down
2 changes: 1 addition & 1 deletion docs/api/state.md
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ func GetStateWithDefault[T any](s *State, key string, defaultVal T) T
**Usage Example:**

```go
// Retrieve a value with a default fallback.
// Retrieve a value with a fallback.
requestCount := GetStateWithDefault[int](app.State(), "requestCount", 0)
fmt.Printf("Request Count: %d\n", requestCount)
```
Expand Down
2 changes: 1 addition & 1 deletion docs/extra/internal.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ Reusing Context objects significantly reduces garbage collection overhead, ensur

## Preforking Mechanism

To take full advantage of multi‑core systems, Fiber offers a prefork mode. In this mode, the master process spawns several child processes that listen on the same port using OS features such as SO_REUSEPORT (or a fallback to SO_REUSEADDR).
To take full advantage of multi‑core systems, Fiber offers a prefork mode. In this mode, the master process spawns several child processes that listen on the same port using OS features such as SO_REUSEPORT (or fall back to SO_REUSEADDR).

```mermaid
flowchart LR
Expand Down
2 changes: 1 addition & 1 deletion docs/guide/extractors.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ Different extraction sources have different security properties and use cases:
When using multiple sources, order them by your security preferences:

```go
// Example: Prefer headers, fallback to cookies, then query
// Example: Prefer headers, fall back to cookies, then query
extractors.Chain(
extractors.FromAuthHeader("Bearer"), // Standard auth
extractors.FromCookie("auth_token"), // Secure storage
Expand Down
2 changes: 1 addition & 1 deletion docs/middleware/csrf.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ You can create advanced extractors for use cases like JWT embedding or JSON body
For applications that need to support both AJAX and form submissions:

```go
// Try header first (AJAX), fallback to form (traditional forms)
// Try header first (AJAX), fall back to form (traditional forms)
app.Use(csrf.New(csrf.Config{
Extractor: extractors.Chain(
extractors.FromHeader("X-Csrf-Token"),
Expand Down
2 changes: 1 addition & 1 deletion docs/whats_new.md
Original file line number Diff line number Diff line change
Expand Up @@ -1173,7 +1173,7 @@ We've made some changes to the CORS middleware to improve its functionality and

#### New Struct Fields

- `Config.AllowPrivateNetwork`: This new field is a boolean that allows you to control whether private networks are allowed. This is related to the [Private Network Access (PNA)](https://wicg.github.io/private-network-access/) specification from the Web Incubator Community Group (WICG). When set to `true`, the CORS middleware will allow CORS preflight requests from private networks and respond with the `Access-Control-Allow-Private-Network: true` header. This could be useful in development environments or specific use cases, but should be done with caution due to potential security risks.
- `Config.AllowPrivateNetwork`: This new field is a boolean that allows you to control whether private networks are allowed. This is related to the [Private Network Access (PNA)](https://wicg.github.io/private-network-access/) specification from the [Web Incubator Community Group (WICG)](https://wicg.io/). When set to `true`, the CORS middleware will allow CORS preflight requests from private networks and respond with the `Access-Control-Allow-Private-Network: true` header. This could be useful in development environments or specific use cases, but should be done with caution due to potential security risks.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fwiw, this wasn't a rule, it was an in-the-neighborhood fix.


#### Updated Struct Fields

Expand Down
2 changes: 1 addition & 1 deletion group.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ⚡️ Fiber is an Express inspired web framework written in Go with ☕️
// 🤖 Github Repository: https://github.com/gofiber/fiber
// 🤖 GitHub Repository: https://github.com/gofiber/fiber
// 📌 API Documentation: https://docs.gofiber.io

package fiber
Expand Down
4 changes: 2 additions & 2 deletions helpers.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ⚡️ Fiber is an Express inspired web framework written in Go with ☕️
// 🤖 Github Repository: https://github.com/gofiber/fiber
// 🤖 GitHub Repository: https://github.com/gofiber/fiber
// 📌 API Documentation: https://docs.gofiber.io

package fiber
Expand Down Expand Up @@ -308,7 +308,7 @@ func acceptsOfferType(spec, offerType string, specParams headerParams) bool {
}

// paramsMatch returns whether offerParams contains all parameters present in specParams.
// Matching is case insensitive, and surrounding quotes are stripped.
// Matching is case-insensitive, and surrounding quotes are stripped.
// To align with the behavior of res.format from Express, the order of parameters is
// ignored, and if a parameter is specified twice in the incoming Accept, the last
// provided value is given precedence.
Expand Down
4 changes: 2 additions & 2 deletions helpers_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ⚡️ Fiber is an Express inspired web framework written in Go with ☕️
// 📝 Github Repository: https://github.com/gofiber/fiber
// 📝 GitHub Repository: https://github.com/gofiber/fiber
// 📌 API Documentation: https://docs.gofiber.io

package fiber
Expand Down Expand Up @@ -222,7 +222,7 @@ func Test_Utils_ParamsMatch(t *testing.T) {
match: true,
},
{
description: "case insensitive",
description: "case-insensitive",
accept: headerParams{"ParaM": []byte("FoO")},
offer: ";pAram=foO",
match: true,
Expand Down
Loading
Loading