| Middleware | توضیحات |
| :------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware provides an HTTP basic authentication. It calls the next handler for valid credentials and 401 Unauthorized for missing or invalid credentials. |
-| [cache](https://github.com/gofiber/fiber/tree/master/middleware/cache) | Intercept and cache responses |
-| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Compression middleware for Fiber, it supports `deflate`, `gzip` and `brotli` by default. |
-| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Enable cross-origin resource sharing \(CORS\) with various options. |
-| [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf) | Protect from CSRF exploits. |
-| [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware which encrypts cookie values. |
-| [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag) | ETag middleware that lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content has not changed. |
-| [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar) | Expvar middleware that serves via its HTTP server runtime exposed variants in the JSON format. |
-| [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon) | Ignore favicon from logs or serve from memory if a file path is provided. |
-| [filesystem](https://github.com/gofiber/fiber/tree/master/middleware/filesystem) | FileSystem middleware for Fiber, special thanks and credits to Alireza Salary |
-| [limiter](https://github.com/gofiber/fiber/tree/master/middleware/limiter) | Rate-limiting middleware for Fiber. Use to limit repeated requests to public APIs and/or endpoints such as password reset. |
-| [logger](https://github.com/gofiber/fiber/tree/master/middleware/logger) | HTTP request/response logger. |
-| [monitor](https://github.com/gofiber/fiber/tree/master/middleware/monitor) | Monitor middleware that reports server metrics, inspired by express-status-monitor |
-| [pprof](https://github.com/gofiber/fiber/tree/master/middleware/pprof) | Special thanks to Matthew Lee \(@mthli\) |
-| [proxy](https://github.com/gofiber/fiber/tree/master/middleware/proxy) | Allows you to proxy requests to a multiple servers |
-| [recover](https://github.com/gofiber/fiber/tree/master/middleware/recover) | Recover middleware recovers from panics anywhere in the stack chain and handles the control to the centralized[ ErrorHandler](https://docs.gofiber.io/guide/error-handling). |
-| [requestid](https://github.com/gofiber/fiber/tree/master/middleware/requestid) | Adds a requestid to every request. |
-| [session](https://github.com/gofiber/fiber/tree/master/middleware/session) | Session middleware. NOTE: This middleware uses our Storage package. |
-| [skip](https://github.com/gofiber/fiber/tree/master/middleware/skip) | Skip middleware that skips a wrapped handler is a predicate is true. |
-| [timeout](https://github.com/gofiber/fiber/tree/master/middleware/timeout) | Adds a max time for a request and forwards to ErrorHandler if it is exceeded. |
+| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) |یک میدلور پایه که سیستم احراز هویت پایه ای را فراهم میکند. در صورت معتبر بودن درخواست روتر بعدی صدا زده شده و در صورت نامعتبر بودن خطای ۴۰۱ نمایش داده میشود.|
+| [cache](https://github.com/gofiber/fiber/tree/master/middleware/cache) |پاسخ هارا رهگیری کرده و انها را به صورت موقت ذخیره میکند.|
+| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | یک میدلور فشرده سازی برای Fiber که به طور پیشفرض از `deflate`, `gzip` و `brotli`. پشتیبانی میکند.| |
+| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) |فعال سازی هدر های cross-origin با گزینه های مختلف.|
+| [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf) |در برابر حملات CSRF ایمنی ایجاد میکند.|
+| [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) |مقادیر کوکی هارا رمزنگاری میکند.|
+| [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag) | میدلور ETag به کش ها اجازه میدهد کارآمد تر عمل کرده و در پهنای باند صرفه جویی کنند. به عنوان یک وب سرور نیازی به دادن پاسخ کامل نیست اگر محتوا تغییر نکرده باشد. |
+| [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar) | میدلور Expvar میتواند متغیر هایی را تعریف کرده و مقادیر انها را در زمان اجرا با فرمت JSON به شما نشان دهد. |
+| [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon) | جلوگیری و یا کش کردن درخواست های favicon در صورتی که مسیر یک فایل را داده باشید.|
+| [filesystem](https://github.com/gofiber/fiber/tree/master/middleware/filesystem) | میدلور FileSystem به شما اجازه میدهد فایل های یک مسیر را عمومی کنید. |
+| [limiter](https://github.com/gofiber/fiber/tree/master/middleware/limiter) |میدلور محدود کننده تعداد درخواست برای Fiber.|
+| [logger](https://github.com/gofiber/fiber/tree/master/middleware/logger) |لاگ گرفتن از درخواست و پاسخ های HTTP.|
+| [monitor](https://github.com/gofiber/fiber/tree/master/middleware/monitor) |وضعیت سرور را مانیتور و گزارش میکند، از express-status-monitor الهام گرفته شده است.|
+| [pprof](https://github.com/gofiber/fiber/tree/master/middleware/pprof) | تشکر ویژه از Matthew Lee \(@mthli\)|
+| [proxy](https://github.com/gofiber/fiber/tree/master/middleware/proxy) | اجازه میدهد درخواست هارا بر روی چند سرور پروکسی کنید. |
+| [recover](https://github.com/gofiber/fiber/tree/master/middleware/recover) |خطا های زمان اجرا را در وب سرور HTTP شما مدیریت میکنند[ ErrorHandler](https://docs.gofiber.io/guide/error-handling). |
+| [requestid](https://github.com/gofiber/fiber/tree/master/middleware/requestid) | به تمامی درخواست ها شناسه ای را اختصاص میدهد.|
+| [session](https://github.com/gofiber/fiber/tree/master/middleware/session) |برای ذخیره و مدیریت شناسه کاربری یا session بازدید کنندگان استفاده .میشود|
+| [skip](https://github.com/gofiber/fiber/tree/master/middleware/skip) |این میدلور میتواند با استفاده از شرط های تعیین شده درخواست هایی را نادیده بگیرد.|
+| [timeout](https://github.com/gofiber/fiber/tree/master/middleware/timeout) |این میدلور محدودیت زمانی ای را برای درخواست ها تنظیم میکند، در صورتی که محدودیت به پایان برسد ErrorHandler صدا زده میشود.|
From ab3874c634d1ffb0331aac9e28266cef628ac193 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?M=2E=20Efe=20=C3=87etin?=
Date: Wed, 29 Jun 2022 12:41:33 +0300
Subject: [PATCH 003/141] :memo: docs: translate some lines to turkish (#1954)
---
.github/README_tr.md | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/.github/README_tr.md b/.github/README_tr.md
index 7103dd2316..ed7e7337cb 100644
--- a/.github/README_tr.md
+++ b/.github/README_tr.md
@@ -565,25 +565,25 @@ Fiber'a dahil edilen middlewareların bir listesi aşağıda verilmiştir.
| Middleware | Açıklama |
| :------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware'i, bir HTTP Basic auth sağlar. Geçerli kimlik bilgileri için sonraki handlerı ve eksik veya geçersiz kimlik bilgileri için 401 döndürür. |
-| [cache](https://github.com/gofiber/fiber/tree/master/middleware/cache) | Reponseları durdur ve önbelleğe al |
+| [basicauth](https://github.com/gofiber/fiber/tree/master/middleware/basicauth) | Basic auth middleware'ı, bir HTTP Basic auth sağlar. Geçerli kimlik bilgileri için sonraki handlerı ve eksik veya geçersiz kimlik bilgileri için 401 döndürür. |
+| [cache](https://github.com/gofiber/fiber/tree/master/middleware/cache) | Reponseları durdur ve önbelleğe al. |
| [compress](https://github.com/gofiber/fiber/tree/master/middleware/compress) | Fiber için sıkıştırma middleware, varsayılan olarak `deflate`, `gzip` ve `brotli`yi destekler. |
| [cors](https://github.com/gofiber/fiber/tree/master/middleware/cors) | Çeşitli seçeneklerle başlangıçlar arası kaynak paylaşımını \(CORS\) etkinleştirin. |
| [csrf](https://github.com/gofiber/fiber/tree/master/middleware/csrf) | CSRF exploitlerinden korunun. |
-| [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware which encrypts cookie values. |
-| [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag) | ETag middleware that lets caches be more efficient and save bandwidth, as a web server does not need to resend a full response if the content has not changed. |
-| [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar) | Expvar middleware that serves via its HTTP server runtime exposed variants in the JSON format. |
+| [encryptcookie](https://github.com/gofiber/fiber/tree/master/middleware/encryptcookie) | Encrypt middleware'ı cookie değerlerini şifreler. |
+| [etag](https://github.com/gofiber/fiber/tree/master/middleware/etag) | ETag middleware'ı sayfa içeriği değişmediyse bant genişliğini daha verimli kullanmak için tam sayfa içeriğini tekrar göndermez. |
+| [expvar](https://github.com/gofiber/fiber/tree/master/middleware/expvar) | Expvar middleware, HTTP serverinin bazı runtime değişkenlerini JSON formatında sunar. |
| [favicon](https://github.com/gofiber/fiber/tree/master/middleware/favicon) | Bir dosya yolu sağlanmışsa, loglardaki favicon'u yoksayar veya bellekten sunar. |
-| [filesystem](https://github.com/gofiber/fiber/tree/master/middleware/filesystem) | Fiber için FileSystem middleware, Alireza Salary'e özel teşekkürler |
+| [filesystem](https://github.com/gofiber/fiber/tree/master/middleware/filesystem) | Fiber için FileSystem middleware, Alireza Salary'e özel teşekkürler. |
| [limiter](https://github.com/gofiber/fiber/tree/master/middleware/limiter) | Fiber için hız sınırlayıcı middleware'i. Açık API'lere ve/veya parola sıfırlama gibi endpointlere yönelik tekrarlanan istekleri sınırlamak için kullanın. |
| [logger](https://github.com/gofiber/fiber/tree/master/middleware/logger) | HTTP istek/yanıt logger'ı. |
-| [monitor](https://github.com/gofiber/fiber/tree/master/middleware/monitor) | Monitor middleware that reports server metrics, inspired by express-status-monitor |
-| [pprof](https://github.com/gofiber/fiber/tree/master/middleware/pprof) | Matthew Lee'ye özel teşekkürler \(@mthli\) |
-| [proxy](https://github.com/gofiber/fiber/tree/master/middleware/proxy) | Birden çok sunucuya proxy istekleri yapmanızı sağlar |
+| [monitor](https://github.com/gofiber/fiber/tree/master/middleware/monitor) | Monitor middleware'ı sunucu metriklerini rapor eder, express-status-monitor'den esinlenildi. |
+| [pprof](https://github.com/gofiber/fiber/tree/master/middleware/pprof) | Matthew Lee'ye özel teşekkürler \(@mthli\). |
+| [proxy](https://github.com/gofiber/fiber/tree/master/middleware/proxy) | Birden çok sunucuya proxy istekleri yapmanızı sağlar. |
| [recover](https://github.com/gofiber/fiber/tree/master/middleware/recover) | Recover middleware'i, stack chain'ini herhangi bir yerindeki paniklerden kurtulur ve kontrolü merkezileştirilmiş [ErrorHandler'e](https://docs.gofiber.io/guide/error-handling) verir. |
-| [requestid](https://github.com/gofiber/fiber/tree/master/middleware/requestid) | Her requeste id verir |
-| [session](https://github.com/gofiber/fiber/tree/master/middleware/session) | Session middleware. NOTE: This middleware uses our Storage package. |
-| [skip](https://github.com/gofiber/fiber/tree/master/middleware/skip) | Skip middleware that skips a wrapped handler is a predicate is true. |
+| [requestid](https://github.com/gofiber/fiber/tree/master/middleware/requestid) | Her requeste id verir. |
+| [session](https://github.com/gofiber/fiber/tree/master/middleware/session) | Session için middleware. NOTE: Bu middleware Fiber'in Storage yapısını kullanır. |
+| [skip](https://github.com/gofiber/fiber/tree/master/middleware/skip) | Skip middleware'ı verilen koşul `true` olduğunda handler'ı atlar ve işlemez. |
| [timeout](https://github.com/gofiber/fiber/tree/master/middleware/timeout) | Bir request için maksimum süre ekler ve aşılırsa ErrorHandler'a iletir. |
## 🧬 Harici Middlewarelar
@@ -596,10 +596,10 @@ Harici olarak barındırılan middlewareların modüllerinin listesi. Bu middlew
| [helmet](https://github.com/gofiber/helmet) | Çeşitli HTTP headerları ayarlayarak uygulamalarınızın güvenliğini sağlamaya yardımcı olur. |
| [jwt](https://github.com/gofiber/jwt) | JWT, bir JSON Web Token \(JWT\) yetkilendirmesi döndüren middleware. |
| [keyauth](https://github.com/gofiber/keyauth) | Key auth middleware, key tabanlı bir authentication sağlar. |
-| [redirect](https://github.com/gofiber/redirect) | Redirect middleware |
+| [redirect](https://github.com/gofiber/redirect) | Yönlendirme middleware 'ı. |
| [rewrite](https://github.com/gofiber/rewrite) | Rewrite middleware, sağlanan kurallara göre URL yolunu yeniden yazar. Geriye dönük uyumluluk için veya yalnızca daha temiz ve daha açıklayıcı bağlantılar oluşturmak için yardımcı olabilir. |
-| [storage](https://github.com/gofiber/storage) | Premade storage drivers that implement the Storage interface, designed to be used with various Fiber middlewares. |
-| [template](https://github.com/gofiber/template) | Bu paket, Fiber `v1.10.x`, Go sürüm 1.13 veya üzeri gerekli olduğunda kullanılabilecek 8 template engine içerir. |
+| [storage](https://github.com/gofiber/storage) | Fiber'in Storage yapısını destekleyen birçok storage driver'ı verir. Bu sayede depolama gerektiren Fiber middlewarelarında kolaylıkla kullanılabilir. |
+| [template](https://github.com/gofiber/template) | Bu paket, Fiber `v2.x.x`, Go sürüm 1.14 veya üzeri gerekli olduğunda kullanılabilecek 9 template motoru içerir. |
| [websocket](https://github.com/gofiber/websocket) | Yereller desteğiyle Fiber için Fasthttp WebSocket'a dayalıdır! |
## 🕶️ Awesome Listesi
From b8b5c8afedb3eeb4535574ed430c720777cac648 Mon Sep 17 00:00:00 2001
From: naoki kuroda <68233204+nnnkkk7@users.noreply.github.com>
Date: Sat, 2 Jul 2022 17:32:09 +0900
Subject: [PATCH 004/141] delete a blank line (#1961)
---
hooks.go | 1 -
1 file changed, 1 deletion(-)
diff --git a/hooks.go b/hooks.go
index b13d491b98..3ea7a00014 100644
--- a/hooks.go
+++ b/hooks.go
@@ -94,7 +94,6 @@ func (h *hooks) executeOnRouteHooks(route Route) error {
}
func (h *hooks) executeOnNameHooks(route Route) error {
-
for _, v := range h.onName {
if err := v(route); err != nil {
return err
From 41d31a019061f8f3b7155b9c92b20a8e0750ddb0 Mon Sep 17 00:00:00 2001
From: John Li
Date: Sat, 2 Jul 2022 19:02:41 +0800
Subject: [PATCH 005/141] fix middleware/session update cookie. (#1960)
---
middleware/session/session.go | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/middleware/session/session.go b/middleware/session/session.go
index c8be6625b3..33be2a1a7d 100644
--- a/middleware/session/session.go
+++ b/middleware/session/session.go
@@ -144,10 +144,8 @@ func (s *Session) Save() error {
s.exp = s.config.Expiration
}
- // Create session with the session ID if fresh
- if s.fresh {
- s.setSession()
- }
+ // Update client cookie
+ s.setSession()
// Convert data to bytes
mux.Lock()
From a337e95463d5b41c86179f8392922dee6de40df3 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Mon, 4 Jul 2022 07:43:03 +0200
Subject: [PATCH 006/141] Bump github.com/valyala/fasthttp from 1.37.0 to
1.38.0 (#1948)
Bumps [github.com/valyala/fasthttp](https://github.com/valyala/fasthttp) from 1.37.0 to 1.38.0.
- [Release notes](https://github.com/valyala/fasthttp/releases)
- [Commits](https://github.com/valyala/fasthttp/compare/v1.37.0...v1.38.0)
---
updated-dependencies:
- dependency-name: github.com/valyala/fasthttp
dependency-type: direct:production
update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot]
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
---
go.mod | 2 +-
go.sum | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/go.mod b/go.mod
index d48909c7ef..3a3ca5d952 100644
--- a/go.mod
+++ b/go.mod
@@ -3,6 +3,6 @@ module github.com/gofiber/fiber/v2
go 1.16
require (
- github.com/valyala/fasthttp v1.37.0
+ github.com/valyala/fasthttp v1.38.0
golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9
)
diff --git a/go.sum b/go.sum
index 5c4ae8555c..2f5953c3dd 100644
--- a/go.sum
+++ b/go.sum
@@ -4,8 +4,8 @@ github.com/klauspost/compress v1.15.0 h1:xqfchp4whNFxn5A4XFyyYtitiWI8Hy5EW59jEwc
github.com/klauspost/compress v1.15.0/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
-github.com/valyala/fasthttp v1.37.0 h1:7WHCyI7EAkQMVmrfBhWTCOaeROb1aCBiTopx63LkMbE=
-github.com/valyala/fasthttp v1.37.0/go.mod h1:t/G+3rLek+CyY9bnIE+YlMRddxVAAGjhxndDB4i4C0I=
+github.com/valyala/fasthttp v1.38.0 h1:yTjSSNjuDi2PPvXY2836bIwLmiTS2T4T9p1coQshpco=
+github.com/valyala/fasthttp v1.38.0/go.mod h1:t/G+3rLek+CyY9bnIE+YlMRddxVAAGjhxndDB4i4C0I=
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
From b6818c20be7d654dfba65755939c8ad31bd8260f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?M=2E=20Efe=20=C3=87etin?=
Date: Mon, 4 Jul 2022 08:49:57 +0300
Subject: [PATCH 007/141] :memo: docs: new issue templates (#1945)
* :memo: docs: new issue templates
* :memo: docs: new issue templates
* :memo: docs: new issue templates
* :memo: docs: new issue templates
* :memo: docs: new issue templates
---
.github/ISSUE_TEMPLATE/---bug.md | 28 -------
.github/ISSUE_TEMPLATE/---feature.md | 16 ----
.github/ISSUE_TEMPLATE/---question.md | 23 ------
.github/ISSUE_TEMPLATE/bug-report.yaml | 85 +++++++++++++++++++++
.github/ISSUE_TEMPLATE/feature-request.yaml | 60 +++++++++++++++
.github/ISSUE_TEMPLATE/question.yaml | 55 +++++++++++++
6 files changed, 200 insertions(+), 67 deletions(-)
delete mode 100644 .github/ISSUE_TEMPLATE/---bug.md
delete mode 100644 .github/ISSUE_TEMPLATE/---feature.md
delete mode 100644 .github/ISSUE_TEMPLATE/---question.md
create mode 100644 .github/ISSUE_TEMPLATE/bug-report.yaml
create mode 100644 .github/ISSUE_TEMPLATE/feature-request.yaml
create mode 100644 .github/ISSUE_TEMPLATE/question.yaml
diff --git a/.github/ISSUE_TEMPLATE/---bug.md b/.github/ISSUE_TEMPLATE/---bug.md
deleted file mode 100644
index a250292311..0000000000
--- a/.github/ISSUE_TEMPLATE/---bug.md
+++ /dev/null
@@ -1,28 +0,0 @@
----
-name: "\U0001F41B Bug"
-about: Create a report to help us improve
-title: "\U0001F41B "
-labels: 'Type: Bug'
-assignees: ''
-
----
-
-**Fiber version**
-
-**Issue description**
-
-**Code snippet**
-
-```go
-package main
-
-import "github.com/gofiber/fiber/v2"
-
-func main() {
- app := fiber.New()
-
- // Steps to reproduce
-
- log.Fatal(app.Listen(":3000"))
-}
-```
diff --git a/.github/ISSUE_TEMPLATE/---feature.md b/.github/ISSUE_TEMPLATE/---feature.md
deleted file mode 100644
index c3baf503a2..0000000000
--- a/.github/ISSUE_TEMPLATE/---feature.md
+++ /dev/null
@@ -1,16 +0,0 @@
----
-name: "\U0001F680 Feature"
-about: Suggest an idea for this project
-title: "\U0001F680 "
-labels: 'Type: Feature'
-assignees: ''
-
----
-
-**Is your feature request related to a problem?**
-
-**Describe the solution you'd like**
-
-**Describe alternatives you've considered**
-
-**Additional context**
diff --git a/.github/ISSUE_TEMPLATE/---question.md b/.github/ISSUE_TEMPLATE/---question.md
deleted file mode 100644
index 68912c2b38..0000000000
--- a/.github/ISSUE_TEMPLATE/---question.md
+++ /dev/null
@@ -1,23 +0,0 @@
----
-name: "\U0001F917 Question"
-about: Ask a question so we can help
-title: "\U0001F917 "
-labels: 'Type: Question'
-assignees: ''
-
----
-
-**Question description**
-
-**Code snippet** _Optional_
-
-```go
-package main
-
-import "github.com/gofiber/fiber/v2"
-
-func main() {
- app := fiber.New()
- // ..
-}
-```
diff --git a/.github/ISSUE_TEMPLATE/bug-report.yaml b/.github/ISSUE_TEMPLATE/bug-report.yaml
new file mode 100644
index 0000000000..c4a902a86f
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug-report.yaml
@@ -0,0 +1,85 @@
+name: "\U0001F41B Bug Report"
+title: "\U0001F41B [Bug]: "
+description: Create a bug report to help us fix it.
+labels: ["☢️ Bug"]
+
+body:
+ - type: markdown
+ id: notice
+ attributes:
+ value: |
+ ### Notice
+ **This repository is not related to external or third-part Fiber modules. If you have a problem with them, open an issue under their repos. If you think the problem is related to Fiber, open the issue here.**
+ - Dont't forget you can ask your questions on our [Discord server](https://gofiber.io/discord).
+ - If you think Fiber doesn't have a nice feature that you think, open the issue with **✏️ Feature Request** template.
+ - Write your issue with clear and understandable English.
+ - type: textarea
+ id: description
+ attributes:
+ label: "Bug Description"
+ description: "A clear and detailed description of what the bug is."
+ placeholder: "Explain your problem as clear and detailed."
+ validations:
+ required: true
+ - type: textarea
+ id: how-to-reproduce
+ attributes:
+ label: How to Reproduce
+ description: "Steps to reproduce the behavior and what should be observed in the end."
+ placeholder: "Tell us step by step how we can replicate your problem and what we should see in the end."
+ value: |
+ Steps to reproduce the behavior:
+ 1. Go to '....'
+ 2. Click on '....'
+ 3. Do '....'
+ 4. See '....'
+ validations:
+ required: true
+ - type: textarea
+ id: expected-behavior
+ attributes:
+ label: Expected Behavior
+ description: "A clear and detailed description of what you think should happens."
+ placeholder: "Tell us what Fiber should normally do."
+ validations:
+ required: true
+ - type: input
+ id: version
+ attributes:
+ label: "Fiber Version"
+ description: "Some bugs may be fixed in future Fiber releases, so we have to know your Fiber version."
+ placeholder: "Write your Fiber version. (v2.33.0, v2.34.1...)"
+ validations:
+ required: true
+ - type: textarea
+ id: snippet
+ attributes:
+ label: "Code Snippet (optional)"
+ description: "For some issues, we need to know some parts of your code."
+ placeholder: "Share a code you think related to the issue."
+ render: go
+ value: |
+ package main
+
+ import "github.com/gofiber/fiber/v2"
+ import "log"
+
+ func main() {
+ app := fiber.New()
+
+ // Steps to reproduce
+
+ log.Fatal(app.Listen(":3000"))
+ }
+ - type: checkboxes
+ id: terms
+ attributes:
+ label: "Checklist:"
+ description: "By submitting this issue, you confirm that:"
+ options:
+ - label: "I agree to follow Fiber's [Code of Conduct](../CODE_OF_CONDUCT.md)."
+ required: true
+ - label: "I have checked for existing issues that describe my problem prior to opening this one."
+ required: true
+ - label: "I understand that improperly formatted bug reports may be closed without explanation."
+ required: true
diff --git a/.github/ISSUE_TEMPLATE/feature-request.yaml b/.github/ISSUE_TEMPLATE/feature-request.yaml
new file mode 100644
index 0000000000..0e63adc060
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature-request.yaml
@@ -0,0 +1,60 @@
+name: "\U0001F680 Feature Request"
+title: "\U0001F680 [Feature]: "
+description: Suggest an idea to improve this project.
+labels: ["✏️ Feature"]
+
+body:
+ - type: markdown
+ id: notice
+ attributes:
+ value: |
+ ### Notice
+ - Dont't forget you can ask your questions on our [Discord server](https://gofiber.io/discord).
+ - If you think this is just a bug, open the issue with **☢️ Bug Report** template.
+ - Write your issue with clear and understandable English.
+ - type: textarea
+ id: description
+ attributes:
+ label: "Feature Description"
+ description: "A clear and detailed description of the feature we need to do."
+ placeholder: "Explain your feature as clear and detailed."
+ validations:
+ required: true
+ - type: textarea
+ id: additional-context
+ attributes:
+ label: "Additional Context (optional)"
+ description: "If you have something else to describe, write them here."
+ placeholder: "Write here what you can describe differently."
+ - type: textarea
+ id: snippet
+ attributes:
+ label: "Code Snippet (optional)"
+ description: "Code snippet may be really helpful to describe some features."
+ placeholder: "Share a code to explain the feature better."
+ render: go
+ value: |
+ package main
+
+ import "github.com/gofiber/fiber/v2"
+ import "log"
+
+ func main() {
+ app := fiber.New()
+
+ // An example to describe the feature
+
+ log.Fatal(app.Listen(":3000"))
+ }
+ - type: checkboxes
+ id: terms
+ attributes:
+ label: "Checklist:"
+ description: "By submitting this issue, you confirm that:"
+ options:
+ - label: "I agree to follow Fiber's [Code of Conduct](../CODE_OF_CONDUCT.md)."
+ required: true
+ - label: "I have checked for existing issues that describe my suggestion prior to opening this one."
+ required: true
+ - label: "I understand that improperly formatted feature requests may be closed without explanation."
+ required: true
diff --git a/.github/ISSUE_TEMPLATE/question.yaml b/.github/ISSUE_TEMPLATE/question.yaml
new file mode 100644
index 0000000000..b1cdfa694c
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/question.yaml
@@ -0,0 +1,55 @@
+name: "🤔 Question"
+title: "\U0001F917 [Question]: "
+description: Ask a question so we can help you easily.
+labels: ["🤔 Question"]
+
+body:
+ - type: markdown
+ id: notice
+ attributes:
+ value: |
+ ### Notice
+ - Dont't forget you can ask your questions on our [Discord server](https://gofiber.io/discord).
+ - If you think this is just a bug, open the issue with **☢️ Bug Report** template.
+ - If you think Fiber doesn't have a nice feature that you think, open the issue with **✏️ Feature Request** template.
+ - Write your issue with clear and understandable English.
+ - type: textarea
+ id: description
+ attributes:
+ label: "Question Description"
+ description: "A clear and detailed description of the question."
+ placeholder: "Explain your question as clear and detailed."
+ validations:
+ required: true
+ - type: textarea
+ id: snippet
+ attributes:
+ label: "Code Snippet (optional)"
+ description: "Code snippet may be really helpful to describe some features."
+ placeholder: "Share a code to explain the feature better."
+ render: go
+ value: |
+ package main
+
+ import "github.com/gofiber/fiber/v2"
+ import "log"
+
+ func main() {
+ app := fiber.New()
+
+ // An example to describe the question
+
+ log.Fatal(app.Listen(":3000"))
+ }
+ - type: checkboxes
+ id: terms
+ attributes:
+ label: "Checklist:"
+ description: "By submitting this issue, you confirm that:"
+ options:
+ - label: "I agree to follow Fiber's [Code of Conduct](../CODE_OF_CONDUCT.md)."
+ required: true
+ - label: "I have checked for existing issues that describe my questions prior to opening this one."
+ required: true
+ - label: "I understand that improperly formatted questions may be closed without explanation."
+ required: true
From dac929fdee341a487057f031d7c2b1172542beca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?M=2E=20Efe=20=C3=87etin?=
Date: Mon, 4 Jul 2022 08:50:37 +0300
Subject: [PATCH 008/141] :broom: client: remove beta warning (#1951)
* :broom: client: remove beta warning
* Stabilize the Test_Test_Timeout unittest
Co-authored-by: wernerr
---
app_test.go | 2 +-
client.go | 5 -----
2 files changed, 1 insertion(+), 6 deletions(-)
diff --git a/app_test.go b/app_test.go
index d1a40ea684..bbc816b14e 100644
--- a/app_test.go
+++ b/app_test.go
@@ -1299,7 +1299,7 @@ func Test_Test_Timeout(t *testing.T) {
utils.AssertEqual(t, 200, resp.StatusCode, "Status code")
app.Get("timeout", func(c *Ctx) error {
- time.Sleep(55 * time.Millisecond)
+ time.Sleep(100 * time.Millisecond)
return nil
})
diff --git a/client.go b/client.go
index e5dd104367..0974b80f24 100644
--- a/client.go
+++ b/client.go
@@ -738,14 +738,9 @@ func (a *Agent) RetryIf(retryIf RetryIfFunc) *Agent {
}
/************************** End Agent Setting **************************/
-var warnOnce sync.Once
// Bytes returns the status code, bytes body and errors of url.
func (a *Agent) Bytes() (code int, body []byte, errs []error) {
- warnOnce.Do(func() {
- fmt.Println("[Warning] client is still in beta, API might change in the future!")
- })
-
defer a.release()
if errs = append(errs, a.errs...); len(errs) > 0 {
From e58ad6b69aa8b3b0de92e0edcd5f8f4c52c23ca2 Mon Sep 17 00:00:00 2001
From: marcelogamba
Date: Mon, 4 Jul 2022 04:14:57 -0300
Subject: [PATCH 009/141] TagLatency doesn't have consistence format between
default and custom format (#1943)
Co-authored-by: Marcelo Gamba
---
middleware/logger/logger.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/middleware/logger/logger.go b/middleware/logger/logger.go
index ad0ce03dbf..6cbffa1e5d 100644
--- a/middleware/logger/logger.go
+++ b/middleware/logger/logger.go
@@ -229,7 +229,7 @@ func New(config ...Config) fiber.Handler {
case TagUA:
return buf.WriteString(c.Get(fiber.HeaderUserAgent))
case TagLatency:
- return buf.WriteString(stop.Sub(start).String())
+ return buf.WriteString(fmt.Sprintf("%7v", stop.Sub(start).Round(time.Millisecond)))
case TagBody:
return buf.Write(c.Body())
case TagBytesReceived:
From 29be2338e80dcca27938e5d23b1a4e5dafff9953 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?M=2E=20Efe=20=C3=87etin?=
Date: Mon, 4 Jul 2022 10:15:17 +0300
Subject: [PATCH 010/141] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20refactor:=20defaul?=
=?UTF-8?q?t=20error=20handler=20&=20example=20(#1941)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* :recycle: refactor: default error handler & example
* ♻️ refactor: default error handler & example
---
app.go | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/app.go b/app.go
index 63957ab3ff..7bbc2d4586 100644
--- a/app.go
+++ b/app.go
@@ -76,7 +76,8 @@ type Storage interface {
// cfg := fiber.Config{}
// cfg.ErrorHandler = func(c *Ctx, err error) error {
// code := StatusInternalServerError
-// if e, ok := err.(*Error); ok {
+// var e *fiber.Error
+// if errors.As(err, &e) {
// code = e.Code
// }
// c.Set(HeaderContentType, MIMETextPlainCharsetUTF8)
@@ -433,7 +434,8 @@ const (
// DefaultErrorHandler that process return errors from handlers
var DefaultErrorHandler = func(c *Ctx, err error) error {
code := StatusInternalServerError
- if e, ok := err.(*Error); ok {
+ var e *Error
+ if errors.As(err, &e) {
code = e.Code
}
c.Set(HeaderContentType, MIMETextPlainCharsetUTF8)
From 744e4da3ef6f934cd0acc87a1486d6f5daecb1b8 Mon Sep 17 00:00:00 2001
From: "Majid Taheri(I love optimization)"
Date: Tue, 5 Jul 2022 16:04:32 +0430
Subject: [PATCH 011/141] add some parameters to config for supporting #1936
(#1956)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* add some parameters to config for supporting #1936
* remove go:embed
* apply code review - 1956#issuecomment-1169811117
* lint
Co-authored-by: Muhammed Efe Çetin
---
middleware/monitor/README.md | 23 ++++++++++++++-
middleware/monitor/config.go | 46 ++++++++++++++++++++++++------
middleware/monitor/index.go | 37 +++++++++++++++++-------
middleware/monitor/monitor_test.go | 44 ++++++++++++++++++++++++++++
4 files changed, 129 insertions(+), 21 deletions(-)
diff --git a/middleware/monitor/README.md b/middleware/monitor/README.md
index 8ac23e4211..5987aec00b 100644
--- a/middleware/monitor/README.md
+++ b/middleware/monitor/README.md
@@ -53,7 +53,7 @@ type Config struct {
// Optional. Default: 3 seconds
Refresh time.Duration
- // To disable serving HTML, you can make true this option.
+ // Whether the service should expose only the monitoring API.
//
// Optional. Default: false
APIOnly bool
@@ -62,6 +62,23 @@ type Config struct {
//
// Optional. Default: nil
Next func(c *fiber.Ctx) bool
+
+ // Custom HTML Code to Head Section(Before End)
+ //
+ // Optional. Default: empty
+ CustomHead string
+
+ // FontURL for specify font resource path or URL . also you can use relative path
+ //
+ // Optional. Default: https://fonts.googleapis.com/css2?family=Roboto:wght@400;900&display=swap
+
+ FontURL string
+ // ChartJsURL for specify ChartJS library path or URL . also you can use relative path
+ //
+ // Optional. Default: https://cdn.jsdelivr.net/npm/chart.js@2.9/dist/Chart.bundle.min.js
+
+ ChartJsURL string
+
}
```
@@ -73,5 +90,9 @@ var ConfigDefault = Config{
Refresh: 3 * time.Second,
APIOnly: false,
Next: nil,
+ CustomHead:"",
+ FontURL:"https://fonts.googleapis.com/css2?family=Roboto:wght@400;900&display=swap",
+ ChartJsURL:"https://cdn.jsdelivr.net/npm/chart.js@2.9/dist/Chart.bundle.min.js"
+
}
```
diff --git a/middleware/monitor/config.go b/middleware/monitor/config.go
index dbd3186835..a5d08b65ca 100644
--- a/middleware/monitor/config.go
+++ b/middleware/monitor/config.go
@@ -28,28 +28,49 @@ type Config struct {
// Optional. Default: nil
Next func(c *fiber.Ctx) bool
- // customized indexHtml
+ // Custom HTML Code to Head Section(Before End)
+ //
+ // Optional. Default: empty
+ CustomHead string
+
+ // FontURL for specify font resource path or URL . also you can use relative path
+ //
+ // Optional. Default: https://fonts.googleapis.com/css2?family=Roboto:wght@400;900&display=swap
+ FontURL string
+
+ // ChartJsURL for specify ChartJS library path or URL . also you can use relative path
+ //
+ // Optional. Default: https://cdn.jsdelivr.net/npm/chart.js@2.9/dist/Chart.bundle.min.js
+ ChartJsURL string
+
index string
}
var ConfigDefault = Config{
- Title: defaultTitle,
- Refresh: defaultRefresh,
- APIOnly: false,
- Next: nil,
- index: newIndex(defaultTitle, defaultRefresh),
+ Title: defaultTitle,
+ Refresh: defaultRefresh,
+ FontURL: defaultFontURL,
+ ChartJsURL: defaultChartJsURL,
+ CustomHead: defaultCustomHead,
+ APIOnly: false,
+ Next: nil,
+ index: newIndex(viewBag{defaultTitle, defaultRefresh, defaultFontURL, defaultChartJsURL,
+ defaultCustomHead}),
}
func configDefault(config ...Config) Config {
// Users can change ConfigDefault.Title/Refresh which then
// become incompatible with ConfigDefault.index
- if ConfigDefault.Title != defaultTitle || ConfigDefault.Refresh != defaultRefresh {
+ if ConfigDefault.Title != defaultTitle || ConfigDefault.Refresh != defaultRefresh ||
+ ConfigDefault.FontURL != defaultFontURL || ConfigDefault.ChartJsURL != defaultChartJsURL ||
+ ConfigDefault.CustomHead != defaultCustomHead {
if ConfigDefault.Refresh < minRefresh {
ConfigDefault.Refresh = minRefresh
}
// update default index with new default title/refresh
- ConfigDefault.index = newIndex(ConfigDefault.Title, ConfigDefault.Refresh)
+ ConfigDefault.index = newIndex(viewBag{ConfigDefault.Title,
+ ConfigDefault.Refresh, ConfigDefault.FontURL, ConfigDefault.ChartJsURL, ConfigDefault.CustomHead})
}
// Return default config if nothing provided
@@ -68,7 +89,13 @@ func configDefault(config ...Config) Config {
if cfg.Refresh == 0 {
cfg.Refresh = ConfigDefault.Refresh
}
+ if cfg.FontURL == "" {
+ cfg.FontURL = defaultFontURL
+ }
+ if cfg.ChartJsURL == "" {
+ cfg.ChartJsURL = defaultChartJsURL
+ }
if cfg.Title == ConfigDefault.Title && cfg.Refresh == ConfigDefault.Refresh {
cfg.index = ConfigDefault.index
} else {
@@ -76,7 +103,8 @@ func configDefault(config ...Config) Config {
cfg.Refresh = minRefresh
}
// update cfg.index with custom title/refresh
- cfg.index = newIndex(cfg.Title, cfg.Refresh)
+ cfg.index = newIndex(viewBag{cfg.Title,
+ cfg.Refresh, cfg.FontURL, cfg.ChartJsURL, cfg.CustomHead})
}
if cfg.Next == nil {
diff --git a/middleware/monitor/index.go b/middleware/monitor/index.go
index 4267b7c4e2..b17c95f9e4 100644
--- a/middleware/monitor/index.go
+++ b/middleware/monitor/index.go
@@ -6,25 +6,37 @@ import (
"time"
)
+type viewBag struct {
+ title string
+ refresh time.Duration
+ fontUrl string
+ chartJsUrl string
+ customHead string
+}
+
// returns index with new title/refresh
-func newIndex(title string, refresh time.Duration) string {
+func newIndex(dat viewBag) string {
- timeout := refresh.Milliseconds() - timeoutDiff
+ timeout := dat.refresh.Milliseconds() - timeoutDiff
if timeout < timeoutDiff {
timeout = timeoutDiff
}
ts := strconv.FormatInt(timeout, 10)
-
- index := strings.ReplaceAll(indexHtml, "$TITLE", title)
- return strings.ReplaceAll(index, "$TIMEOUT", ts)
+ replacer := strings.NewReplacer("$TITLE", dat.title, "$TIMEOUT", ts,
+ "$FONT_URL", dat.fontUrl, "$CHART_JS_URL", dat.chartJsUrl, "$CUSTOM_HEAD", dat.customHead,
+ )
+ return replacer.Replace(indexHtml)
}
const (
defaultTitle = "Fiber Monitor"
- defaultRefresh = 3 * time.Second
- timeoutDiff = 200 // timeout will be Refresh (in millisconds) - timeoutDiff
- minRefresh = timeoutDiff * time.Millisecond
+ defaultRefresh = 3 * time.Second
+ timeoutDiff = 200 // timeout will be Refresh (in milliseconds) - timeoutDiff
+ minRefresh = timeoutDiff * time.Millisecond
+ defaultFontURL = `https://fonts.googleapis.com/css2?family=Roboto:wght@400;900&display=swap`
+ defaultChartJsURL = `https://cdn.jsdelivr.net/npm/chart.js@2.9/dist/Chart.bundle.min.js`
+ defaultCustomHead = ``
// parametrized by $TITLE and $TIMEOUT
indexHtml = `
@@ -32,8 +44,9 @@ const (
-
-
+
+
+
$TITLE
@@ -253,5 +267,6 @@ const (
fetchJSON()
-