diff --git a/.github/README.md b/.github/README.md
index 5d6db8fbd1..45c10be6c4 100644
--- a/.github/README.md
+++ b/.github/README.md
@@ -148,7 +148,7 @@ Fiber is **inspired** by Express, the most popular web framework on the Internet
We **listen** to our users in [issues](https://github.com/gofiber/fiber/issues), Discord [channel](https://gofiber.io/discord) _and all over the Internet_ to create a **fast**, **flexible** and **friendly** Go web framework for **any** task, **deadline** and developer **skill**! Just like Express does in the JavaScript world.
## ⚠️ Limitations
-* Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 2.29.0 has been tested with Go versions 1.14 to 1.19.
+* Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 2.40.0 has been tested with Go versions 1.16 to 1.19.
* Fiber is not compatible with net/http interfaces. This means you will not be able to use projects like gqlgen, go-swagger, or any others which are part of the net/http ecosystem.
## 👀 Examples
diff --git a/.github/README_de.md b/.github/README_de.md
index 1960b28e6e..6fa4a2b1d0 100644
--- a/.github/README_de.md
+++ b/.github/README_de.md
@@ -142,7 +142,7 @@ Neue Gopher, welche von [Node.js](https://nodejs.org/en/about/) zu [Go](https://
Fiber ist **inspiriert** von Express.js, dem beliebtesten Web-Framework im Internet. Wir haben die **Leichtigkeit** von Express und die **Rohleistung** von Go kombiniert. Wenn du jemals eine Webanwendung mit Node.js implementiert hast (_mit Express.js oder ähnlichem_), werden dir viele Methoden und Prinzipien **sehr vertraut** vorkommen.
## ⚠️ Limitations
-* Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 2.29.0 has been tested with Go versions 1.14 to 1.19.
+* Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 2.40.0 has been tested with Go versions 1.16 to 1.19.
* Fiber is not compatible with net/http interfaces. This means you will not be able to use projects like gqlgen, go-swagger, or any others which are part of the net/http ecosystem.
## 👀 Beispiele
diff --git a/.github/README_es.md b/.github/README_es.md
index 976ceb6ece..cf524f6287 100644
--- a/.github/README_es.md
+++ b/.github/README_es.md
@@ -142,7 +142,7 @@ Los nuevos gophers que hacen el cambio de [Node.js](https://nodejs.org/en/about/
Fiber está **inspirado** en Expressjs, el framework web más popular en Internet. Combinamos la **facilidad** de Express y **el rendimiento bruto** de Go. Si alguna vez ha implementado una aplicación web en Node.js ( _utilizando Express.js o similar_ ), muchos métodos y principios le parecerán **muy comunes** .
## ⚠️ Limitantes
-* Debido a que Fiber utiliza unsafe, la biblioteca no siempre será compatible con la última versión de Go. Fiber 2.29.0 ha sido probado con las versiones de Go 1.14 a 1.19.
+* Debido a que Fiber utiliza unsafe, la biblioteca no siempre será compatible con la última versión de Go. Fiber 2.40.0 ha sido probado con las versiones de Go 1.16 a 1.19.
* Fiber no es compatible con interfaces net/http. Esto significa que no lo podrá usar en proyectos como qglgen, go-swagger, u otros que son parte del ecosistema net/http.
## 👀 Ejemplos
diff --git a/.github/README_fa.md b/.github/README_fa.md
index 8c2d615a82..30afaa5f83 100644
--- a/.github/README_fa.md
+++ b/.github/README_fa.md
@@ -182,7 +182,7 @@ Fiber از Express الهام گرفته, که محبوب ترین فری
## ⚠️ محدودیت ها
-* به دلیل استفاده ناامن از Fiber, ممکن است کتابخانه همیشه با آخرین نسخه Go سازگار نباشد. Fiber 2.29.0 با زبان گو نسخه ۱.۱۴ تا ۱.۱۷ تست شده است.
+* به دلیل استفاده ناامن از Fiber, ممکن است کتابخانه همیشه با آخرین نسخه Go سازگار نباشد. Fiber 2.40.0 با زبان گو نسخه 1.16 تا 1.19 تست شده است.
* فریمورک Fiber با پکیج net/http سازگار نیست. این بدان معناست شما نمی توانید از پکیج های مانند go-swagger, gqlgen یا سایر پروژه هایی که بخشی از اکوسیستم net/http هستند استفاده کنید.
diff --git a/.github/README_fr.md b/.github/README_fr.md
index 217108adb9..f0ad7525b0 100644
--- a/.github/README_fr.md
+++ b/.github/README_fr.md
@@ -142,7 +142,7 @@ Les nouveaux gophers qui passent de [Node.js](https://nodejs.org/en/about/) à [
Fiber est **inspiré** par Express, le framework web le plus populaire d'Internet. Nous avons combiné la **facilité** d'Express, et la **performance brute** de Go. Si vous avez déja développé une application web en Node.js (_en utilisant Express ou équivalent_), alors de nombreuses méthodes et principes vous sembleront **familiers**.
## ⚠️ Limitations
-* Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 2.29.0 has been tested with Go versions 1.14 to 1.19.
+* Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 2.40.0 has been tested with Go versions 1.16 to 1.19.
* Fiber is not compatible with net/http interfaces. This means you will not be able to use projects like gqlgen, go-swagger, or any others which are part of the net/http ecosystem.
## 👀 Exemples
diff --git a/.github/README_he.md b/.github/README_he.md
index 7b19957e0e..aacf2777e7 100644
--- a/.github/README_he.md
+++ b/.github/README_he.md
@@ -187,7 +187,7 @@ Fiber נוצרה **בהשראת** Express, ה-web framework הפופולרית
## ⚠️ Limitations
-* Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 2.29.0 has been tested with Go versions 1.14 to 1.19.
+* Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 2.40.0 has been tested with Go versions 1.16 to 1.19.
* Fiber is not compatible with net/http interfaces. This means you will not be able to use projects like gqlgen, go-swagger, or any others which are part of the net/http ecosystem.
## 👀 דוגמאות
diff --git a/.github/README_id.md b/.github/README_id.md
index 5b7253e4d4..b16b32d6c8 100644
--- a/.github/README_id.md
+++ b/.github/README_id.md
@@ -145,7 +145,7 @@ Kami **mendengarkan** para pengguna di [GitHub Issues](https://github.com/gofibe
## ⚠️ Limitasi
-* Karena penggunaan Fiber yang tidak aman, perpustakaan mungkin tidak selalu kompatibel dengan versi Go terbaru. Fiber 2.29.0 telah diuji dengan Go versi 1.14 hingga 1.19.
+* Karena penggunaan Fiber yang tidak aman, perpustakaan mungkin tidak selalu kompatibel dengan versi Go terbaru. Fiber 2.40.0 telah diuji dengan Go versi 1.16 hingga 1.19.
* Fiber tidak kompatibel dengan antarmuka net/http. Ini berarti kamu tidak akan dapat menggunakan proyek seperti gqlgen, go-swagger, atau lainnya yang merupakan bagian dari ekosistem net/http.
## 👀 Contoh
diff --git a/.github/README_it.md b/.github/README_it.md
index 81ab44a879..5651c3ebee 100644
--- a/.github/README_it.md
+++ b/.github/README_it.md
@@ -143,7 +143,7 @@ Fiber è **ispirato** da Express, il web framework più popolare su internet. Ab
## ⚠️ Limitazioni
-* Dato che Fiber utilizza unsafe, la libreria non sempre potrebbe essere compatibile con l'ultima versione di Go. Fiber 2.29.0 è stato testato con la versioni 1.14 alla 1.19 di Go.
+* Dato che Fiber utilizza unsafe, la libreria non sempre potrebbe essere compatibile con l'ultima versione di Go. Fiber 2.40.0 è stato testato con la versioni 1.16 alla 1.19 di Go.
* Fiber non è compatibile con le interfacce net/http. Questo significa che non è possibile utilizzare progetti come qglgen, go-swagger, o altri che fanno parte dell'ecosistema net/http.
## 👀 Esempi
diff --git a/.github/README_ja.md b/.github/README_ja.md
index 88b97c2b4f..f15e5247dd 100644
--- a/.github/README_ja.md
+++ b/.github/README_ja.md
@@ -147,7 +147,7 @@ Fiber は人気の高い Web フレームワークである Expressjs に**イ
## ⚠️ 制限事項
-- Fiber は unsafe パッケージを使用しているため、最新の Go バージョンと互換性がない場合があります。Fiber 2.29.0 は、Go のバージョン 1.14 から 1.19 でテストされています。
+- Fiber は unsafe パッケージを使用しているため、最新の Go バージョンと互換性がない場合があります。Fiber 2.40.0 は、Go のバージョン 1.16 から 1.19 でテストされています。
- Fiber は net/http インターフェースと互換性がありません。つまり、gqlgen や go-swagger など、net/http のエコシステムの一部であるプロジェクトを使用することができません。
## 👀 例
diff --git a/.github/README_ko.md b/.github/README_ko.md
index 291b5acefa..6c14afc5e0 100644
--- a/.github/README_ko.md
+++ b/.github/README_ko.md
@@ -144,7 +144,7 @@ Fiber는 인터넷에서 가장 인기있는 웹 프레임워크인 Express에
우리는 **어떤한** 작업, **마감일정**, 개발자의 **기술**이던간에 **빠르고**, **유연하고**, **익숙한** Go 웹 프레임워크를 만들기 위해 사용자들의 [이슈들](https://github.com/gofiber/fiber/issues)을(그리고 모든 인터넷을 통해) **듣고 있습니다**! Express가 자바스크립트 세계에서 하는 것 처럼요.
## ⚠️ 한계점
-* Fiber는 unsafe 패키지를 사용하기 때문에 최신 Go버전과 호환되지 않을 수 있습니다.Fiber 2.29.0은 Go 버전 1.14에서 1.19로 테스트되고 있습니다.
+* Fiber는 unsafe 패키지를 사용하기 때문에 최신 Go버전과 호환되지 않을 수 있습니다.Fiber 2.40.0은 Go 버전 1.16에서 1.19로 테스트되고 있습니다.
* Fiber는 net/http 인터페이스와 호환되지 않습니다.즉, gqlgen이나 go-swagger 등 net/http 생태계의 일부인 프로젝트를 사용할 수 없습니다.
## 👀 예제
diff --git a/.github/README_nl.md b/.github/README_nl.md
index 3d2a73f175..2bf40e931f 100644
--- a/.github/README_nl.md
+++ b/.github/README_nl.md
@@ -144,7 +144,7 @@ Fiber is **geïnspireerd** door Express, het populairste webframework op interne
We **luisteren** naar onze gebruikers in [issues](https://github.com/gofiber/fiber/issues) (_en overal op het internet_) om een **snelle**, **flexibele** en **vriendelijk** Go web framework te maken voor **elke** taak, **deadline** en ontwikkelaar **vaardigheid**! Net zoals Express dat doet in de JavaScript-wereld.
## ⚠️ Limitations
-* Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 2.29.0 has been tested with Go versions 1.14 to 1.19.
+* Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 2.40.0 has been tested with Go versions 1.16 to 1.19.
* Fiber is not compatible with net/http interfaces. This means you will not be able to use projects like gqlgen, go-swagger, or any others which are part of the net/http ecosystem.
## 👀 Voorbeelden
diff --git a/.github/README_pt.md b/.github/README_pt.md
index a120a1767e..f4bfaa0412 100644
--- a/.github/README_pt.md
+++ b/.github/README_pt.md
@@ -142,7 +142,7 @@ Os novos gophers que mudaram do [Node.js](https://nodejs.org/en/about/) para o [
O Fiber é **inspirado** no Express, o framework web mais popular da Internet. Combinamos a **facilidade** do Express e com o **desempenho bruto** do Go. Se você já implementou um aplicativo web com Node.js ( _usando Express.js ou similar_ ), então muitos métodos e princípios parecerão **muito familiares** para você.
## ⚠️ Limitations
-* Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 2.29.0 has been tested with Go versions 1.14 to 1.19.
+* Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 2.40.0 has been tested with Go versions 1.16 to 1.19.
* Fiber is not compatible with net/http interfaces. This means you will not be able to use projects like gqlgen, go-swagger, or any others which are part of the net/http ecosystem.
## 👀 Exemplos
diff --git a/.github/README_ru.md b/.github/README_ru.md
index b314713cea..05063c44f1 100644
--- a/.github/README_ru.md
+++ b/.github/README_ru.md
@@ -144,7 +144,7 @@ Fiber **вдохновлен** Express, самым популярным веб
Мы **прислушиваемся** к нашим пользователям в [issues](https://github.com/gofiber/fiber/issues), Discord [канале](https://gofiber.io/discord) _и в остальном Интернете_, чтобы создать **быстрый**, **гибкий** и **дружелюбный** веб фреймворк на Go для **любых** задач, **дедлайнов** и **уровней** разработчиков! Как это делает Express в мире JavaScript.
## ⚠️ Limitations
-* Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 2.29.0 has been tested with Go versions 1.14 to 1.19.
+* Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 2.40.0 has been tested with Go versions 1.16 to 1.19.
* Fiber is not compatible with net/http interfaces. This means you will not be able to use projects like gqlgen, go-swagger, or any others which are part of the net/http ecosystem.
## 👀 Примеры
diff --git a/.github/README_sa.md b/.github/README_sa.md
index e8605edaef..50a0b63257 100644
--- a/.github/README_sa.md
+++ b/.github/README_sa.md
@@ -158,7 +158,7 @@ Fiber هو **مستوحى** من Express, إطار الويب الأكثر شع
** و تطوير **مهارات**! فقط مثل Express تفعل لـ JavaScript عالم.
## ⚠️ Limitations
-* Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 2.29.0 has been tested with Go versions 1.14 to 1.19.
+* Due to Fiber's usage of unsafe, the library may not always be compatible with the latest Go version. Fiber 2.40.0 has been tested with Go versions 1.16 to 1.19.
* Fiber is not compatible with net/http interfaces. This means you will not be able to use projects like gqlgen, go-swagger, or any others which are part of the net/http ecosystem.
## 👀 أمثلة
diff --git a/.github/README_tr.md b/.github/README_tr.md
index 4375426a26..f775218c0f 100644
--- a/.github/README_tr.md
+++ b/.github/README_tr.md
@@ -143,7 +143,7 @@ Fiber, internet üzerinde en popüler web framework'ü olan Express'ten **esinle
## ⚠️ Sınırlamalar
-- Fiber unsafe kullanımı sebebiyle Go'nun son sürümüyle her zaman uyumlu olmayabilir. Fiber 2.29.0, Go 1.14 ile 1.19 sürümleriyle test edildi.
+- Fiber unsafe kullanımı sebebiyle Go'nun son sürümüyle her zaman uyumlu olmayabilir. Fiber 2.40.0, Go 1.14 ile 1.19 sürümleriyle test edildi.
- Fiber net/http arabirimiyle uyumlu değildir. Yani gqlgen veya go-swagger gibi net/http ekosisteminin parçası olan projeleri kullanamazsınız.
## 👀 Örnekler
diff --git a/.github/README_zh-CN.md b/.github/README_zh-CN.md
index 5dfd510f14..7697ae6ee0 100644
--- a/.github/README_zh-CN.md
+++ b/.github/README_zh-CN.md
@@ -144,7 +144,7 @@ go get -u github.com/gofiber/fiber/v2
我们会**倾听**用户在[issues](https://github.com/gofiber/fiber/issues)和 Discord [channel](https://gofiber.io/discord)和在互联网上的所有诉求,为了创建一个能让有着任何技术栈的开发者都能在deadline前完成任务的**迅速**,**灵活**以及**友好**的`Go web`框架,就像`Express`在`JavaScript`世界中一样。
## ⚠️ 限制
-* 由于 Fiber 使用了 unsafe 特性,导致其可能与最新的 Go 版本不兼容。Fiber 2.29.0 已经在 Go 1.14 到 1.19 上测试过。
+* 由于 Fiber 使用了 unsafe 特性,导致其可能与最新的 Go 版本不兼容。Fiber 2.40.0 已经在 Go 1.16 到 1.19 上测试过。
* Fiber 与 net/http 接口不兼容。也就是说你无法使用 gqlen,go-swagger 或者任何其他属于 net/http 生态的项目。
## 👀 示例
diff --git a/.github/README_zh-TW.md b/.github/README_zh-TW.md
index 90e58b24be..61d012e230 100644
--- a/.github/README_zh-TW.md
+++ b/.github/README_zh-TW.md
@@ -144,7 +144,7 @@ Fiber **受到** 網路上最流行的 Web 框架 ExpressJS**啟發**,結合 E
有什麼問題請發[issues](https://github.com/gofiber/fiber/issues)或加入 Discord [channel](https://gofiber.io/discord)討論,我們想要創造**快速**、**彈性**、**友善**的社群給**任何人**使用!就像 Express 那樣。
## 限制
-* 由於 Fiber 使用了 unsafe,該庫可能並不總是與最新的 Go 版本兼容。 Fiber 2.29.0 已經用 Go 版本 1.14 到 1.19 進行了測試。
+* 由於 Fiber 使用了 unsafe,該庫可能並不總是與最新的 Go 版本兼容。 Fiber 2.40.0 已經用 Go 版本 1.16 到 1.19 進行了測試。
* Fiber 與 net/http 接口不兼容。 這意味著您將無法使用 gqlgen、go-swagger 或任何其他屬於 net/http 生態系統的項目。
## 👀 範例
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 000f7717ef..c83f89e8c4 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -8,7 +8,7 @@ jobs:
Build:
strategy:
matrix:
- go-version: [1.14.x, 1.16.x, 1.19.x]
+ go-version: [1.16.x, 1.17.x, 1.19.x]
platform: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.platform }}
steps:
diff --git a/app_test.go b/app_test.go
index acfa8f9b3d..2bef6a4796 100644
--- a/app_test.go
+++ b/app_test.go
@@ -10,7 +10,6 @@ import (
"errors"
"fmt"
"io"
- "io/ioutil"
"mime/multipart"
"net"
"net/http"
@@ -44,7 +43,7 @@ func testErrorResponse(t *testing.T, err error, resp *http.Response, expectedBod
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, 500, resp.StatusCode, "Status code")
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, expectedBodyError, string(body), "Response body")
}
@@ -162,7 +161,7 @@ func Test_App_Errors(t *testing.T) {
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, 500, resp.StatusCode, "Status code")
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "hi, i'm an error", string(body))
@@ -187,7 +186,7 @@ func Test_App_ErrorHandler_Custom(t *testing.T) {
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, 200, resp.StatusCode, "Status code")
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "hi, i'm an custom error", string(body))
}
@@ -216,7 +215,7 @@ func Test_App_ErrorHandler_HandlerStack(t *testing.T) {
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, 500, resp.StatusCode, "Status code")
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "1: USE error", string(body))
}
@@ -241,7 +240,7 @@ func Test_App_ErrorHandler_RouteStack(t *testing.T) {
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, 500, resp.StatusCode, "Status code")
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "1: USE error", string(body))
}
@@ -328,7 +327,7 @@ func Test_App_Use_UnescapedPath(t *testing.T) {
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, StatusOK, resp.StatusCode, "Status code")
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err, "app.Test(req)")
// check the param result
utils.AssertEqual(t, "اختبار", app.getString(body))
@@ -363,7 +362,7 @@ func Test_App_Use_CaseSensitive(t *testing.T) {
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, StatusOK, resp.StatusCode, "Status code")
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err, "app.Test(req)")
// check the detected path result
utils.AssertEqual(t, "/AbC", app.getString(body))
@@ -534,7 +533,7 @@ func Test_App_Order(t *testing.T) {
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, 200, resp.StatusCode, "Status code")
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "123", string(body))
}
@@ -656,7 +655,7 @@ func Test_App_Static_Index_Default(t *testing.T) {
utils.AssertEqual(t, false, resp.Header.Get(HeaderContentLength) == "")
utils.AssertEqual(t, MIMETextHTMLCharsetUTF8, resp.Header.Get(HeaderContentType))
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, true, strings.Contains(string(body), "Hello, World!"))
@@ -666,7 +665,7 @@ func Test_App_Static_Index_Default(t *testing.T) {
utils.AssertEqual(t, false, resp.Header.Get(HeaderContentLength) == "")
utils.AssertEqual(t, MIMETextPlainCharsetUTF8, resp.Header.Get(HeaderContentType))
- body, err = ioutil.ReadAll(resp.Body)
+ body, err = io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "Cannot GET /not-found", string(body))
}
@@ -683,7 +682,7 @@ func Test_App_Static_Direct(t *testing.T) {
utils.AssertEqual(t, false, resp.Header.Get(HeaderContentLength) == "")
utils.AssertEqual(t, MIMETextHTMLCharsetUTF8, resp.Header.Get(HeaderContentType))
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, true, strings.Contains(string(body), "Hello, World!"))
@@ -694,7 +693,7 @@ func Test_App_Static_Direct(t *testing.T) {
utils.AssertEqual(t, MIMEApplicationJSON, resp.Header.Get("Content-Type"))
utils.AssertEqual(t, "", resp.Header.Get(HeaderCacheControl), "CacheControl Control")
- body, err = ioutil.ReadAll(resp.Body)
+ body, err = io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, true, strings.Contains(string(body), "testRoutes"))
}
@@ -791,7 +790,7 @@ func Test_App_Static_Wildcard(t *testing.T) {
utils.AssertEqual(t, false, resp.Header.Get(HeaderContentLength) == "")
utils.AssertEqual(t, MIMETextHTMLCharsetUTF8, resp.Header.Get(HeaderContentType))
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, true, strings.Contains(string(body), "Test file"))
}
@@ -816,7 +815,7 @@ func Test_App_Static_Prefix_Wildcard(t *testing.T) {
utils.AssertEqual(t, false, resp.Header.Get(HeaderContentLength) == "")
utils.AssertEqual(t, MIMETextHTMLCharsetUTF8, resp.Header.Get(HeaderContentType))
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, true, strings.Contains(string(body), "Test file"))
}
@@ -919,7 +918,7 @@ func Test_App_Static_Next(t *testing.T) {
utils.AssertEqual(t, false, resp.Header.Get(HeaderContentLength) == "")
utils.AssertEqual(t, MIMETextPlainCharsetUTF8, resp.Header.Get(HeaderContentType))
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, true, strings.Contains(string(body), "You've skipped app.Static"))
})
@@ -933,7 +932,7 @@ func Test_App_Static_Next(t *testing.T) {
utils.AssertEqual(t, false, resp.Header.Get(HeaderContentLength) == "")
utils.AssertEqual(t, MIMETextHTMLCharsetUTF8, resp.Header.Get(HeaderContentType))
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, true, strings.Contains(string(body), "Hello, World!"))
})
@@ -964,7 +963,7 @@ func Test_App_Mixed_Routes_WithSameLen(t *testing.T) {
utils.AssertEqual(t, "TestValue", resp.Header.Get("TestHeader"))
utils.AssertEqual(t, "text/html", resp.Header.Get(HeaderContentType))
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "FOO_BAR", string(body))
@@ -977,7 +976,7 @@ func Test_App_Mixed_Routes_WithSameLen(t *testing.T) {
utils.AssertEqual(t, "TestValue", resp.Header.Get("TestHeader"))
utils.AssertEqual(t, "text/html; charset=utf-8", resp.Header.Get(HeaderContentType))
- body, err = ioutil.ReadAll(resp.Body)
+ body, err = io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, true, strings.Contains(string(body), "Hello, World!"), "Response: "+string(body))
utils.AssertEqual(t, true, strings.HasPrefix(string(body), ""), "Response: "+string(body))
@@ -1415,8 +1414,8 @@ func Test_App_ReadBodyStream(t *testing.T) {
testString := "this is a test"
resp, err := app.Test(httptest.NewRequest("POST", "/", bytes.NewBufferString(testString)))
utils.AssertEqual(t, nil, err, "app.Test(req)")
- body, err := ioutil.ReadAll(resp.Body)
- utils.AssertEqual(t, nil, err, "ioutil.ReadAll(resp.Body)")
+ body, err := io.ReadAll(resp.Body)
+ utils.AssertEqual(t, nil, err, "io.ReadAll(resp.Body)")
utils.AssertEqual(t, fmt.Sprintf("true %s", testString), string(body))
}
@@ -1461,8 +1460,8 @@ func Test_App_DisablePreParseMultipartForm(t *testing.T) {
req.Header.Set("Content-Type", w.FormDataContentType())
resp, err := app.Test(req)
utils.AssertEqual(t, nil, err, "app.Test(req)")
- body, err := ioutil.ReadAll(resp.Body)
- utils.AssertEqual(t, nil, err, "ioutil.ReadAll(resp.Body)")
+ body, err := io.ReadAll(resp.Body)
+ utils.AssertEqual(t, nil, err, "io.ReadAll(resp.Body)")
utils.AssertEqual(t, testString, string(body))
}
diff --git a/client.go b/client.go
index 4a520b7886..02816db228 100644
--- a/client.go
+++ b/client.go
@@ -7,7 +7,6 @@ import (
"encoding/xml"
"fmt"
"io"
- "io/ioutil"
"mime/multipart"
"net"
"os"
@@ -542,7 +541,7 @@ func (a *Agent) FileData(formFiles ...*FormFile) *Agent {
// SendFile reads file and appends it to multipart form request.
func (a *Agent) SendFile(filename string, fieldname ...string) *Agent {
- content, err := ioutil.ReadFile(filepath.Clean(filename))
+ content, err := os.ReadFile(filepath.Clean(filename))
if err != nil {
a.errs = append(a.errs, err)
return a
diff --git a/client_test.go b/client_test.go
index d753054620..c8e93c5e85 100644
--- a/client_test.go
+++ b/client_test.go
@@ -8,9 +8,9 @@ import (
"errors"
"fmt"
"io"
- "io/ioutil"
"mime/multipart"
"net"
+ "os"
"path/filepath"
"regexp"
"strings"
@@ -811,7 +811,7 @@ func checkFormFile(t *testing.T, fh *multipart.FileHeader, filename string) {
basename := filepath.Base(filename)
utils.AssertEqual(t, fh.Filename, basename)
- b1, err := ioutil.ReadFile(filename)
+ b1, err := os.ReadFile(filename)
utils.AssertEqual(t, nil, err)
b2 := make([]byte, fh.Size)
diff --git a/ctx.go b/ctx.go
index 0fa466e5c3..595399992a 100644
--- a/ctx.go
+++ b/ctx.go
@@ -13,7 +13,6 @@ import (
"errors"
"fmt"
"io"
- "io/ioutil"
"mime/multipart"
"net"
"net/http"
@@ -1489,7 +1488,7 @@ func (c *Ctx) SaveFileToStorage(fileheader *multipart.FileHeader, path string, s
return err
}
- content, err := ioutil.ReadAll(file)
+ content, err := io.ReadAll(file)
if err != nil {
return err
}
diff --git a/ctx_test.go b/ctx_test.go
index f1ba1f6cde..5d27c34b9e 100644
--- a/ctx_test.go
+++ b/ctx_test.go
@@ -17,7 +17,6 @@ import (
"errors"
"fmt"
"io"
- "io/ioutil"
"mime/multipart"
"net/http/httptest"
"net/url"
@@ -670,7 +669,7 @@ func Test_Ctx_UserContext_Multiple_Requests(t *testing.T) {
utils.AssertEqual(t, nil, err, "Unexpected error from response")
utils.AssertEqual(t, StatusOK, resp.StatusCode, "context.Context returned from c.UserContext() is reused")
- b, err := ioutil.ReadAll(resp.Body)
+ b, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err, "Unexpected error from reading response body")
utils.AssertEqual(t, fmt.Sprintf("resp_%d_returned", i), string(b), "response text incorrect")
})
@@ -1129,7 +1128,7 @@ func Test_Ctx_PortInHandler(t *testing.T) {
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, StatusOK, resp.StatusCode, "Status code")
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "0", string(body))
}
@@ -1527,7 +1526,7 @@ func Test_Ctx_ClientHelloInfo(t *testing.T) {
// Test without TLS handler
resp, _ := app.Test(httptest.NewRequest(MethodGet, "/ServerName", nil))
- body, _ := ioutil.ReadAll(resp.Body)
+ body, _ := io.ReadAll(resp.Body)
utils.AssertEqual(t, []byte("ClientHelloInfo is nil"), body)
// Test with TLS Handler
@@ -1543,17 +1542,17 @@ func Test_Ctx_ClientHelloInfo(t *testing.T) {
// Test ServerName
resp, _ = app.Test(httptest.NewRequest(MethodGet, "/ServerName", nil))
- body, _ = ioutil.ReadAll(resp.Body)
+ body, _ = io.ReadAll(resp.Body)
utils.AssertEqual(t, []byte("example.golang"), body)
// Test SignatureSchemes
resp, _ = app.Test(httptest.NewRequest(MethodGet, "/SignatureSchemes", nil))
- body, _ = ioutil.ReadAll(resp.Body)
+ body, _ = io.ReadAll(resp.Body)
utils.AssertEqual(t, "["+strconv.Itoa(PSSWithSHA256)+"]", string(body))
// Test SupportedVersions
resp, _ = app.Test(httptest.NewRequest(MethodGet, "/SupportedVersions", nil))
- body, _ = ioutil.ReadAll(resp.Body)
+ body, _ = io.ReadAll(resp.Body)
utils.AssertEqual(t, "["+strconv.Itoa(VersionTLS13)+"]", string(body))
}
@@ -2106,14 +2105,14 @@ func Test_Ctx_SaveFile(t *testing.T) {
fh, err := c.FormFile("file")
utils.AssertEqual(t, nil, err)
- tempFile, err := ioutil.TempFile(os.TempDir(), "test-")
+ tempFile, err := os.CreateTemp(os.TempDir(), "test-")
utils.AssertEqual(t, nil, err)
defer os.Remove(tempFile.Name())
err = c.SaveFile(fh, tempFile.Name())
utils.AssertEqual(t, nil, err)
- bs, err := ioutil.ReadFile(tempFile.Name())
+ bs, err := os.ReadFile(tempFile.Name())
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "hello world", string(bs))
return nil
@@ -2257,7 +2256,7 @@ func Test_Ctx_Download(t *testing.T) {
utils.AssertEqual(t, nil, err)
defer f.Close()
- expect, err := ioutil.ReadAll(f)
+ expect, err := io.ReadAll(f)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, expect, c.Response().Body())
utils.AssertEqual(t, `attachment; filename="Awesome+File%21"`, string(c.Response().Header.Peek(HeaderContentDisposition)))
@@ -2275,7 +2274,7 @@ func Test_Ctx_SendFile(t *testing.T) {
f, err := os.Open("./ctx.go")
utils.AssertEqual(t, nil, err)
defer f.Close()
- expectFileContent, err := ioutil.ReadAll(f)
+ expectFileContent, err := io.ReadAll(f)
utils.AssertEqual(t, nil, err)
// fetch file info for the not modified test case
fI, err := os.Stat("./ctx.go")
@@ -3278,7 +3277,7 @@ func Test_Ctx_Render_Engine_Error(t *testing.T) {
func Test_Ctx_Render_Go_Template(t *testing.T) {
t.Parallel()
- file, err := ioutil.TempFile(os.TempDir(), "fiber")
+ file, err := os.CreateTemp(os.TempDir(), "fiber")
utils.AssertEqual(t, nil, err)
defer os.Remove(file.Name())
diff --git a/internal/gopsutil/common/common.go b/internal/gopsutil/common/common.go
index 5c7adace0e..a02fce4b1a 100644
--- a/internal/gopsutil/common/common.go
+++ b/internal/gopsutil/common/common.go
@@ -12,7 +12,6 @@ import (
"context"
"errors"
"fmt"
- "io/ioutil"
"log"
"net/url"
"os"
@@ -84,7 +83,7 @@ func (i FakeInvoke) Command(name string, arg ...string) ([]byte, error) {
fpath += "_" + i.Suffix
}
if PathExists(fpath) {
- return ioutil.ReadFile(fpath)
+ return os.ReadFile(fpath)
}
return []byte{}, fmt.Errorf("could not find testdata: %s", fpath)
}
@@ -97,7 +96,7 @@ var ErrNotImplementedError = errors.New("not implemented yet")
// ReadFile reads contents from a file
func ReadFile(filename string) (string, error) {
- content, err := ioutil.ReadFile(filename)
+ content, err := os.ReadFile(filename)
if err != nil {
return "", err
diff --git a/internal/gopsutil/load/load_linux.go b/internal/gopsutil/load/load_linux.go
index 8cdd84243d..422e20075f 100644
--- a/internal/gopsutil/load/load_linux.go
+++ b/internal/gopsutil/load/load_linux.go
@@ -5,7 +5,7 @@ package load
import (
"context"
- "io/ioutil"
+ "os"
"strconv"
"strings"
"syscall"
@@ -76,7 +76,7 @@ func Misc() (*MiscStat, error) {
func MiscWithContext(ctx context.Context) (*MiscStat, error) {
filename := common.HostProc("stat")
- out, err := ioutil.ReadFile(filename)
+ out, err := os.ReadFile(filename)
if err != nil {
return nil, err
}
@@ -126,7 +126,7 @@ func getProcsTotal() (int64, error) {
func readLoadAvgFromFile() ([]string, error) {
loadavgFilename := common.HostProc("loadavg")
- line, err := ioutil.ReadFile(loadavgFilename)
+ line, err := os.ReadFile(loadavgFilename)
if err != nil {
return nil, err
}
diff --git a/internal/gopsutil/net/net_linux.go b/internal/gopsutil/net/net_linux.go
index 7c7d3bd90c..de8a3a7e80 100644
--- a/internal/gopsutil/net/net_linux.go
+++ b/internal/gopsutil/net/net_linux.go
@@ -10,7 +10,6 @@ import (
"errors"
"fmt"
"io"
- "io/ioutil"
"net"
"os"
"strconv"
@@ -637,7 +636,7 @@ func (p *process) getUids() ([]int32, error) {
func (p *process) fillFromStatus() error {
pid := p.Pid
statPath := common.HostProc(strconv.Itoa(int(pid)), "status")
- contents, err := ioutil.ReadFile(statPath)
+ contents, err := os.ReadFile(statPath)
if err != nil {
return err
}
@@ -759,7 +758,7 @@ func processInet(file string, kind netConnectionKindType, inodes map[string][]in
// This minimizes duplicates in the returned connections
// For more info:
// https://github.com/shirou/gopsutil/pull/361
- contents, err := ioutil.ReadFile(file)
+ contents, err := os.ReadFile(file)
if err != nil {
return nil, err
}
@@ -820,7 +819,7 @@ func processUnix(file string, kind netConnectionKindType, inodes map[string][]in
// This minimizes duplicates in the returned connections
// For more info:
// https://github.com/shirou/gopsutil/pull/361
- contents, err := ioutil.ReadFile(file)
+ contents, err := os.ReadFile(file)
if err != nil {
return nil, err
}
diff --git a/internal/gopsutil/process/process_linux.go b/internal/gopsutil/process/process_linux.go
index 73ce975b5e..05d3e7ab26 100644
--- a/internal/gopsutil/process/process_linux.go
+++ b/internal/gopsutil/process/process_linux.go
@@ -9,7 +9,6 @@ import (
"context"
"encoding/json"
"fmt"
- "io/ioutil"
"math"
"os"
"path/filepath"
@@ -190,7 +189,7 @@ func (p *Process) ForegroundWithContext(ctx context.Context) (bool, error) {
// see https://github.com/shirou/gopsutil/issues/596#issuecomment-432707831 for implementation details
pid := p.Pid
statPath := common.HostProc(strconv.Itoa(int(pid)), "stat")
- contents, err := ioutil.ReadFile(statPath)
+ contents, err := os.ReadFile(statPath)
if err != nil {
return false, err
}
@@ -566,7 +565,7 @@ func (p *Process) MemoryMapsWithContext(ctx context.Context, grouped bool) (*[]M
ret = make([]MemoryMapsStat, 1)
}
smapsPath := common.HostProc(strconv.Itoa(int(pid)), "smaps")
- contents, err := ioutil.ReadFile(smapsPath)
+ contents, err := os.ReadFile(smapsPath)
if err != nil {
return nil, err
}
@@ -830,7 +829,7 @@ func (p *Process) fillFromExeWithContext(ctx context.Context) (string, error) {
func (p *Process) fillFromCmdlineWithContext(ctx context.Context) (string, error) {
pid := p.Pid
cmdPath := common.HostProc(strconv.Itoa(int(pid)), "cmdline")
- cmdline, err := ioutil.ReadFile(cmdPath)
+ cmdline, err := os.ReadFile(cmdPath)
if err != nil {
return "", err
}
@@ -847,7 +846,7 @@ func (p *Process) fillFromCmdlineWithContext(ctx context.Context) (string, error
func (p *Process) fillSliceFromCmdlineWithContext(ctx context.Context) ([]string, error) {
pid := p.Pid
cmdPath := common.HostProc(strconv.Itoa(int(pid)), "cmdline")
- cmdline, err := ioutil.ReadFile(cmdPath)
+ cmdline, err := os.ReadFile(cmdPath)
if err != nil {
return nil, err
}
@@ -870,7 +869,7 @@ func (p *Process) fillSliceFromCmdlineWithContext(ctx context.Context) ([]string
func (p *Process) fillFromIOWithContext(ctx context.Context) (*IOCountersStat, error) {
pid := p.Pid
ioPath := common.HostProc(strconv.Itoa(int(pid)), "io")
- ioline, err := ioutil.ReadFile(ioPath)
+ ioline, err := os.ReadFile(ioPath)
if err != nil {
return nil, err
}
@@ -909,7 +908,7 @@ func (p *Process) fillFromIOWithContext(ctx context.Context) (*IOCountersStat, e
func (p *Process) fillFromStatmWithContext(ctx context.Context) (*MemoryInfoStat, *MemoryInfoExStat, error) {
pid := p.Pid
memPath := common.HostProc(strconv.Itoa(int(pid)), "statm")
- contents, err := ioutil.ReadFile(memPath)
+ contents, err := os.ReadFile(memPath)
if err != nil {
return nil, nil, err
}
@@ -961,7 +960,7 @@ func (p *Process) fillFromStatmWithContext(ctx context.Context) (*MemoryInfoStat
func (p *Process) fillFromStatusWithContext(ctx context.Context) error {
pid := p.Pid
statPath := common.HostProc(strconv.Itoa(int(pid)), "status")
- contents, err := ioutil.ReadFile(statPath)
+ contents, err := os.ReadFile(statPath)
if err != nil {
return err
}
@@ -1147,7 +1146,7 @@ func (p *Process) fillFromTIDStatWithContext(ctx context.Context, tid int32) (ui
statPath = common.HostProc(strconv.Itoa(int(pid)), "task", strconv.Itoa(int(tid)), "stat")
}
- contents, err := ioutil.ReadFile(statPath)
+ contents, err := os.ReadFile(statPath)
if err != nil {
return 0, 0, nil, 0, 0, 0, nil, err
}
diff --git a/internal/msgp/file_port.go b/internal/msgp/file_port.go
index 7280a8b943..5f44b2f581 100644
--- a/internal/msgp/file_port.go
+++ b/internal/msgp/file_port.go
@@ -4,7 +4,7 @@
package msgp
import (
- "io/ioutil"
+ "io"
"os"
)
@@ -21,7 +21,7 @@ func ReadFile(dst Unmarshaler, file *os.File) error {
return u.DecodeMsg(NewReader(file))
}
- data, err := ioutil.ReadAll(file)
+ data, err := io.ReadAll(file)
if err != nil {
return err
}
diff --git a/internal/template/utils/utils.go b/internal/template/utils/utils.go
index a19e6d6e24..0ae8f22fd8 100644
--- a/internal/template/utils/utils.go
+++ b/internal/template/utils/utils.go
@@ -1,7 +1,7 @@
package utils
import (
- "io/ioutil"
+ "io"
"net/http"
"os"
pathpkg "path"
@@ -30,9 +30,9 @@ func ReadFile(path string, fs http.FileSystem) ([]byte, error) {
return nil, err
}
defer file.Close()
- return ioutil.ReadAll(file)
+ return io.ReadAll(file)
}
- return ioutil.ReadFile(path)
+ return os.ReadFile(path)
}
// readDirNames reads the directory named by dirname and returns
diff --git a/listen.go b/listen.go
index d23d426780..ddbf8c81fc 100644
--- a/listen.go
+++ b/listen.go
@@ -9,7 +9,6 @@ import (
"crypto/x509"
"errors"
"fmt"
- "io/ioutil"
"net"
"os"
"path/filepath"
@@ -154,7 +153,7 @@ func (app *App) ListenMutualTLS(addr, certFile, keyFile, clientCertFile string)
return fmt.Errorf("tls: cannot load TLS key pair from certFile=%q and keyFile=%q: %s", certFile, keyFile, err)
}
- clientCACert, err := ioutil.ReadFile(filepath.Clean(clientCertFile))
+ clientCACert, err := os.ReadFile(filepath.Clean(clientCertFile))
if err != nil {
return err
}
diff --git a/middleware/basicauth/basicauth_test.go b/middleware/basicauth/basicauth_test.go
index 8bfdd21df8..9046059e8d 100644
--- a/middleware/basicauth/basicauth_test.go
+++ b/middleware/basicauth/basicauth_test.go
@@ -2,7 +2,7 @@ package basicauth
import (
"fmt"
- "io/ioutil"
+ "io"
"net/http/httptest"
"testing"
@@ -82,7 +82,7 @@ func Test_Middleware_BasicAuth(t *testing.T) {
resp, err := app.Test(req)
utils.AssertEqual(t, nil, err)
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, tt.statusCode, resp.StatusCode)
diff --git a/middleware/cache/cache_test.go b/middleware/cache/cache_test.go
index 3216a7c48a..e261023820 100644
--- a/middleware/cache/cache_test.go
+++ b/middleware/cache/cache_test.go
@@ -6,17 +6,17 @@ import (
"bytes"
"fmt"
"io"
- "io/ioutil"
"math"
"net/http"
"net/http/httptest"
+ "os"
"strconv"
"testing"
"time"
"github.com/gofiber/fiber/v2"
- "github.com/gofiber/fiber/v2/middleware/etag"
"github.com/gofiber/fiber/v2/internal/storage/memory"
+ "github.com/gofiber/fiber/v2/middleware/etag"
"github.com/gofiber/fiber/v2/utils"
"github.com/valyala/fasthttp"
)
@@ -55,7 +55,7 @@ func Test_Cache_Expired(t *testing.T) {
resp, err := app.Test(httptest.NewRequest("GET", "/", nil))
utils.AssertEqual(t, nil, err)
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
// Sleep until the cache is expired
@@ -63,7 +63,7 @@ func Test_Cache_Expired(t *testing.T) {
respCached, err := app.Test(httptest.NewRequest("GET", "/", nil))
utils.AssertEqual(t, nil, err)
- bodyCached, err := ioutil.ReadAll(respCached.Body)
+ bodyCached, err := io.ReadAll(respCached.Body)
utils.AssertEqual(t, nil, err)
if bytes.Equal(body, bodyCached) {
@@ -73,7 +73,7 @@ func Test_Cache_Expired(t *testing.T) {
// Next response should be also cached
respCachedNextRound, err := app.Test(httptest.NewRequest("GET", "/", nil))
utils.AssertEqual(t, nil, err)
- bodyCachedNextRound, err := ioutil.ReadAll(respCachedNextRound.Body)
+ bodyCachedNextRound, err := io.ReadAll(respCachedNextRound.Body)
utils.AssertEqual(t, nil, err)
if !bytes.Equal(bodyCachedNextRound, bodyCached) {
@@ -100,9 +100,9 @@ func Test_Cache(t *testing.T) {
cachedResp, err := app.Test(cachedReq)
utils.AssertEqual(t, nil, err)
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
- cachedBody, err := ioutil.ReadAll(cachedResp.Body)
+ cachedBody, err := io.ReadAll(cachedResp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, cachedBody, body)
@@ -123,7 +123,7 @@ func Test_Cache_WithNoCacheRequestDirective(t *testing.T) {
req := httptest.NewRequest("GET", "/", nil)
resp, err := app.Test(req)
defer resp.Body.Close()
- body, _ := ioutil.ReadAll(resp.Body)
+ body, _ := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, cacheMiss, resp.Header.Get("X-Cache"))
utils.AssertEqual(t, []byte("1"), body)
@@ -133,7 +133,7 @@ func Test_Cache_WithNoCacheRequestDirective(t *testing.T) {
cachedReq := httptest.NewRequest("GET", "/?id=2", nil)
cachedResp, err := app.Test(cachedReq)
defer cachedResp.Body.Close()
- cachedBody, _ := ioutil.ReadAll(cachedResp.Body)
+ cachedBody, _ := io.ReadAll(cachedResp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, cacheHit, cachedResp.Header.Get("X-Cache"))
utils.AssertEqual(t, []byte("1"), cachedBody)
@@ -144,7 +144,7 @@ func Test_Cache_WithNoCacheRequestDirective(t *testing.T) {
noCacheReq.Header.Set(fiber.HeaderCacheControl, noCache)
noCacheResp, err := app.Test(noCacheReq)
defer noCacheResp.Body.Close()
- noCacheBody, _ := ioutil.ReadAll(noCacheResp.Body)
+ noCacheBody, _ := io.ReadAll(noCacheResp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, cacheMiss, noCacheResp.Header.Get("X-Cache"))
utils.AssertEqual(t, []byte("2"), noCacheBody)
@@ -156,7 +156,7 @@ func Test_Cache_WithNoCacheRequestDirective(t *testing.T) {
noCacheReq1.Header.Set(fiber.HeaderCacheControl, noCache)
noCacheResp1, err := app.Test(noCacheReq1)
defer noCacheResp1.Body.Close()
- noCacheBody1, _ := ioutil.ReadAll(noCacheResp1.Body)
+ noCacheBody1, _ := io.ReadAll(noCacheResp1.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, cacheMiss, noCacheResp1.Header.Get("X-Cache"))
utils.AssertEqual(t, []byte("2"), noCacheBody1)
@@ -166,7 +166,7 @@ func Test_Cache_WithNoCacheRequestDirective(t *testing.T) {
cachedReq1 := httptest.NewRequest("GET", "/", nil)
cachedResp1, err := app.Test(cachedReq1)
defer cachedResp1.Body.Close()
- cachedBody1, _ := ioutil.ReadAll(cachedResp1.Body)
+ cachedBody1, _ := io.ReadAll(cachedResp1.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, cacheHit, cachedResp1.Header.Get("X-Cache"))
utils.AssertEqual(t, []byte("2"), cachedBody1)
@@ -255,7 +255,7 @@ func Test_Cache_WithNoStoreRequestDirective(t *testing.T) {
noStoreReq.Header.Set(fiber.HeaderCacheControl, noStore)
noStoreResp, err := app.Test(noStoreReq)
defer noStoreResp.Body.Close()
- noStoreBody, _ := ioutil.ReadAll(noStoreResp.Body)
+ noStoreBody, _ := io.ReadAll(noStoreResp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, []byte("2"), noStoreBody)
// Response not cached, returns updated response
@@ -286,7 +286,7 @@ func Test_Cache_WithSeveralRequests(t *testing.T) {
utils.AssertEqual(t, nil, err)
}(rsp.Body)
- idFromServ, err := ioutil.ReadAll(rsp.Body)
+ idFromServ, err := io.ReadAll(rsp.Body)
utils.AssertEqual(t, nil, err)
a, err := strconv.Atoi(string(idFromServ))
@@ -319,9 +319,9 @@ func Test_Cache_Invalid_Expiration(t *testing.T) {
cachedResp, err := app.Test(cachedReq)
utils.AssertEqual(t, nil, err)
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
- cachedBody, err := ioutil.ReadAll(cachedResp.Body)
+ cachedBody, err := io.ReadAll(cachedResp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, cachedBody, body)
@@ -344,25 +344,25 @@ func Test_Cache_Get(t *testing.T) {
resp, err := app.Test(httptest.NewRequest("POST", "/?cache=123", nil))
utils.AssertEqual(t, nil, err)
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "123", string(body))
resp, err = app.Test(httptest.NewRequest("POST", "/?cache=12345", nil))
utils.AssertEqual(t, nil, err)
- body, err = ioutil.ReadAll(resp.Body)
+ body, err = io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "12345", string(body))
resp, err = app.Test(httptest.NewRequest("GET", "/get?cache=123", nil))
utils.AssertEqual(t, nil, err)
- body, err = ioutil.ReadAll(resp.Body)
+ body, err = io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "123", string(body))
resp, err = app.Test(httptest.NewRequest("GET", "/get?cache=12345", nil))
utils.AssertEqual(t, nil, err)
- body, err = ioutil.ReadAll(resp.Body)
+ body, err = io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "123", string(body))
}
@@ -386,25 +386,25 @@ func Test_Cache_Post(t *testing.T) {
resp, err := app.Test(httptest.NewRequest("POST", "/?cache=123", nil))
utils.AssertEqual(t, nil, err)
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "123", string(body))
resp, err = app.Test(httptest.NewRequest("POST", "/?cache=12345", nil))
utils.AssertEqual(t, nil, err)
- body, err = ioutil.ReadAll(resp.Body)
+ body, err = io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "123", string(body))
resp, err = app.Test(httptest.NewRequest("GET", "/get?cache=123", nil))
utils.AssertEqual(t, nil, err)
- body, err = ioutil.ReadAll(resp.Body)
+ body, err = io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "123", string(body))
resp, err = app.Test(httptest.NewRequest("GET", "/get?cache=12345", nil))
utils.AssertEqual(t, nil, err)
- body, err = ioutil.ReadAll(resp.Body)
+ body, err = io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "12345", string(body))
}
@@ -422,14 +422,14 @@ func Test_Cache_NothingToCache(t *testing.T) {
resp, err := app.Test(httptest.NewRequest("GET", "/", nil))
utils.AssertEqual(t, nil, err)
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
time.Sleep(500 * time.Millisecond)
respCached, err := app.Test(httptest.NewRequest("GET", "/", nil))
utils.AssertEqual(t, nil, err)
- bodyCached, err := ioutil.ReadAll(respCached.Body)
+ bodyCached, err := io.ReadAll(respCached.Body)
utils.AssertEqual(t, nil, err)
if bytes.Equal(body, bodyCached) {
@@ -459,12 +459,12 @@ func Test_Cache_CustomNext(t *testing.T) {
resp, err := app.Test(httptest.NewRequest("GET", "/", nil))
utils.AssertEqual(t, nil, err)
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
respCached, err := app.Test(httptest.NewRequest("GET", "/", nil))
utils.AssertEqual(t, nil, err)
- bodyCached, err := ioutil.ReadAll(respCached.Body)
+ bodyCached, err := io.ReadAll(respCached.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, true, bytes.Equal(body, bodyCached))
utils.AssertEqual(t, true, respCached.Header.Get(fiber.HeaderCacheControl) != "")
@@ -526,9 +526,9 @@ func Test_CustomExpiration(t *testing.T) {
cachedResp, err := app.Test(httptest.NewRequest("GET", "/", nil))
utils.AssertEqual(t, nil, err)
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
- cachedBody, err := ioutil.ReadAll(cachedResp.Body)
+ cachedBody, err := io.ReadAll(cachedResp.Body)
utils.AssertEqual(t, nil, err)
if bytes.Equal(body, cachedBody) {
@@ -538,7 +538,7 @@ func Test_CustomExpiration(t *testing.T) {
// Next response should be cached
cachedRespNextRound, err := app.Test(httptest.NewRequest("GET", "/", nil))
utils.AssertEqual(t, nil, err)
- cachedBodyNextRound, err := ioutil.ReadAll(cachedRespNextRound.Body)
+ cachedBodyNextRound, err := io.ReadAll(cachedRespNextRound.Body)
utils.AssertEqual(t, nil, err)
if !bytes.Equal(cachedBodyNextRound, cachedBody) {
@@ -632,9 +632,9 @@ func Test_Cache_WithHead(t *testing.T) {
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, cacheHit, cachedResp.Header.Get("X-Cache"))
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
- cachedBody, err := ioutil.ReadAll(cachedResp.Body)
+ cachedBody, err := io.ReadAll(cachedResp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, cachedBody, body)
@@ -651,28 +651,28 @@ func Test_Cache_WithHeadThenGet(t *testing.T) {
headResp, err := app.Test(httptest.NewRequest("HEAD", "/?cache=123", nil))
utils.AssertEqual(t, nil, err)
- headBody, err := ioutil.ReadAll(headResp.Body)
+ headBody, err := io.ReadAll(headResp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "", string(headBody))
utils.AssertEqual(t, cacheMiss, headResp.Header.Get("X-Cache"))
headResp, err = app.Test(httptest.NewRequest("HEAD", "/?cache=123", nil))
utils.AssertEqual(t, nil, err)
- headBody, err = ioutil.ReadAll(headResp.Body)
+ headBody, err = io.ReadAll(headResp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "", string(headBody))
utils.AssertEqual(t, cacheHit, headResp.Header.Get("X-Cache"))
getResp, err := app.Test(httptest.NewRequest("GET", "/?cache=123", nil))
utils.AssertEqual(t, nil, err)
- getBody, err := ioutil.ReadAll(getResp.Body)
+ getBody, err := io.ReadAll(getResp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "123", string(getBody))
utils.AssertEqual(t, cacheMiss, getResp.Header.Get("X-Cache"))
getResp, err = app.Test(httptest.NewRequest("GET", "/?cache=123", nil))
utils.AssertEqual(t, nil, err)
- getBody, err = ioutil.ReadAll(getResp.Body)
+ getBody, err = io.ReadAll(getResp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "123", string(getBody))
utils.AssertEqual(t, cacheHit, getResp.Header.Get("X-Cache"))
@@ -785,7 +785,7 @@ func Benchmark_Cache(b *testing.B) {
app.Use(New())
app.Get("/demo", func(c *fiber.Ctx) error {
- data, _ := ioutil.ReadFile("../../.github/README.md")
+ data, _ := os.ReadFile("../../.github/README.md")
return c.Status(fiber.StatusTeapot).Send(data)
})
@@ -815,7 +815,7 @@ func Benchmark_Cache_Storage(b *testing.B) {
}))
app.Get("/demo", func(c *fiber.Ctx) error {
- data, _ := ioutil.ReadFile("../../.github/README.md")
+ data, _ := os.ReadFile("../../.github/README.md")
return c.Status(fiber.StatusTeapot).Send(data)
})
diff --git a/middleware/compress/compress_test.go b/middleware/compress/compress_test.go
index 75110f3f66..e2ad5acc4f 100644
--- a/middleware/compress/compress_test.go
+++ b/middleware/compress/compress_test.go
@@ -3,8 +3,9 @@ package compress
import (
"errors"
"fmt"
- "io/ioutil"
+ "io"
"net/http/httptest"
+ "os"
"testing"
"github.com/gofiber/fiber/v2"
@@ -14,7 +15,7 @@ import (
var filedata []byte
func init() {
- dat, err := ioutil.ReadFile("../../.github/README.md")
+ dat, err := os.ReadFile("../../.github/README.md")
if err != nil {
panic(err)
}
@@ -41,7 +42,7 @@ func Test_Compress_Gzip(t *testing.T) {
utils.AssertEqual(t, "gzip", resp.Header.Get(fiber.HeaderContentEncoding))
// Validate that the file size has shrunk
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, true, len(body) < len(filedata))
}
@@ -69,7 +70,7 @@ func Test_Compress_Different_Level(t *testing.T) {
utils.AssertEqual(t, "gzip", resp.Header.Get(fiber.HeaderContentEncoding))
// Validate that the file size has shrunk
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, true, len(body) < len(filedata))
})
@@ -94,7 +95,7 @@ func Test_Compress_Deflate(t *testing.T) {
utils.AssertEqual(t, "deflate", resp.Header.Get(fiber.HeaderContentEncoding))
// Validate that the file size has shrunk
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, true, len(body) < len(filedata))
}
@@ -117,7 +118,7 @@ func Test_Compress_Brotli(t *testing.T) {
utils.AssertEqual(t, "br", resp.Header.Get(fiber.HeaderContentEncoding))
// Validate that the file size has shrunk
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, true, len(body) < len(filedata))
}
@@ -140,7 +141,7 @@ func Test_Compress_Disabled(t *testing.T) {
utils.AssertEqual(t, "", resp.Header.Get(fiber.HeaderContentEncoding))
// Validate the file size is not shrunk
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, true, len(body) == len(filedata))
}
@@ -162,7 +163,7 @@ func Test_Compress_Next_Error(t *testing.T) {
utils.AssertEqual(t, 500, resp.StatusCode, "Status code")
utils.AssertEqual(t, "", resp.Header.Get(fiber.HeaderContentEncoding))
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "next error", string(body))
}
diff --git a/middleware/envvar/envvar_test.go b/middleware/envvar/envvar_test.go
index 56fc44fe1e..34d8a05074 100644
--- a/middleware/envvar/envvar_test.go
+++ b/middleware/envvar/envvar_test.go
@@ -2,7 +2,7 @@ package envvar
import (
"encoding/json"
- "io/ioutil"
+ "io"
"net/http"
"os"
"testing"
@@ -48,7 +48,7 @@ func TestEnvVarHandler(t *testing.T) {
resp, err := app.Test(req)
utils.AssertEqual(t, nil, err)
- respBody, err := ioutil.ReadAll(resp.Body)
+ respBody, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, expectedEnvVarResponse, respBody)
@@ -68,7 +68,7 @@ func TestEnvVarHandlerNotMatched(t *testing.T) {
resp, err := app.Test(req)
utils.AssertEqual(t, nil, err)
- respBody, err := ioutil.ReadAll(resp.Body)
+ respBody, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, []byte("OK"), respBody)
@@ -85,7 +85,7 @@ func TestEnvVarHandlerDefaultConfig(t *testing.T) {
resp, err := app.Test(req)
utils.AssertEqual(t, nil, err)
- respBody, err := ioutil.ReadAll(resp.Body)
+ respBody, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
var envVars EnvVar
@@ -118,7 +118,7 @@ func TestEnvVarHandlerSpecialValue(t *testing.T) {
resp, err := app.Test(req)
utils.AssertEqual(t, nil, err)
- respBody, err := ioutil.ReadAll(resp.Body)
+ respBody, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
var envVars EnvVar
@@ -130,7 +130,7 @@ func TestEnvVarHandlerSpecialValue(t *testing.T) {
resp, err = app.Test(req)
utils.AssertEqual(t, nil, err)
- respBody, err = ioutil.ReadAll(resp.Body)
+ respBody, err = io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
var envVarsExport EnvVar
diff --git a/middleware/etag/etag_test.go b/middleware/etag/etag_test.go
index c5765fc8ba..3b01cc89fe 100644
--- a/middleware/etag/etag_test.go
+++ b/middleware/etag/etag_test.go
@@ -2,7 +2,7 @@ package etag
import (
"bytes"
- "io/ioutil"
+ "io"
"net/http/httptest"
"testing"
@@ -114,7 +114,7 @@ func testETagNewEtag(t *testing.T, headerIfNoneMatch, matched bool) {
if matched {
utils.AssertEqual(t, fiber.StatusNotModified, resp.StatusCode)
- b, err := ioutil.ReadAll(resp.Body)
+ b, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, 0, len(b))
}
@@ -164,7 +164,7 @@ func testETagWeakEtag(t *testing.T, headerIfNoneMatch, matched bool) {
if matched {
utils.AssertEqual(t, fiber.StatusNotModified, resp.StatusCode)
- b, err := ioutil.ReadAll(resp.Body)
+ b, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, 0, len(b))
}
@@ -218,7 +218,7 @@ func testETagCustomEtag(t *testing.T, headerIfNoneMatch, matched bool) {
if matched {
utils.AssertEqual(t, fiber.StatusNotModified, resp.StatusCode)
- b, err := ioutil.ReadAll(resp.Body)
+ b, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, 0, len(b))
}
diff --git a/middleware/expvar/expvar_test.go b/middleware/expvar/expvar_test.go
index c202c2cba0..7240c93a62 100644
--- a/middleware/expvar/expvar_test.go
+++ b/middleware/expvar/expvar_test.go
@@ -2,7 +2,7 @@ package expvar
import (
"bytes"
- "io/ioutil"
+ "io"
"net/http/httptest"
"testing"
@@ -23,7 +23,7 @@ func Test_Non_Expvar_Path(t *testing.T) {
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, 200, resp.StatusCode)
- b, err := ioutil.ReadAll(resp.Body)
+ b, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "escaped", string(b))
}
@@ -42,7 +42,7 @@ func Test_Expvar_Index(t *testing.T) {
utils.AssertEqual(t, 200, resp.StatusCode)
utils.AssertEqual(t, fiber.MIMEApplicationJSONCharsetUTF8, resp.Header.Get(fiber.HeaderContentType))
- b, err := ioutil.ReadAll(resp.Body)
+ b, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, true, bytes.Contains(b, []byte("cmdline")))
utils.AssertEqual(t, true, bytes.Contains(b, []byte("memstat")))
@@ -62,7 +62,7 @@ func Test_Expvar_Filter(t *testing.T) {
utils.AssertEqual(t, 200, resp.StatusCode)
utils.AssertEqual(t, fiber.MIMEApplicationJSONCharsetUTF8, resp.Header.Get(fiber.HeaderContentType))
- b, err := ioutil.ReadAll(resp.Body)
+ b, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, true, bytes.Contains(b, []byte("cmdline")))
utils.AssertEqual(t, false, bytes.Contains(b, []byte("memstat")))
diff --git a/middleware/favicon/favicon.go b/middleware/favicon/favicon.go
index 5f7bcbfbb0..66b688093c 100644
--- a/middleware/favicon/favicon.go
+++ b/middleware/favicon/favicon.go
@@ -1,8 +1,9 @@
package favicon
import (
- "io/ioutil"
+ "io"
"net/http"
+ "os"
"strconv"
"github.com/gofiber/fiber/v2"
@@ -80,10 +81,10 @@ func New(config ...Config) fiber.Handler {
if err != nil {
panic(err)
}
- if icon, err = ioutil.ReadAll(f); err != nil {
+ if icon, err = io.ReadAll(f); err != nil {
panic(err)
}
- } else if icon, err = ioutil.ReadFile(cfg.File); err != nil {
+ } else if icon, err = os.ReadFile(cfg.File); err != nil {
panic(err)
}
diff --git a/middleware/limiter/limiter_test.go b/middleware/limiter/limiter_test.go
index 2a3e3d6fa0..acf0f0026b 100644
--- a/middleware/limiter/limiter_test.go
+++ b/middleware/limiter/limiter_test.go
@@ -1,7 +1,7 @@
package limiter
import (
- "io/ioutil"
+ "io"
"net/http"
"net/http/httptest"
"sync"
@@ -37,7 +37,7 @@ func Test_Limiter_Concurrency_Store(t *testing.T) {
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, fiber.StatusOK, resp.StatusCode)
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "Hello tester!", string(body))
}
@@ -82,7 +82,7 @@ func Test_Limiter_Concurrency(t *testing.T) {
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, fiber.StatusOK, resp.StatusCode)
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "Hello tester!", string(body))
}
diff --git a/middleware/logger/logger_test.go b/middleware/logger/logger_test.go
index 95f053a008..43522fa300 100644
--- a/middleware/logger/logger_test.go
+++ b/middleware/logger/logger_test.go
@@ -3,7 +3,7 @@ package logger
import (
"errors"
"fmt"
- "io/ioutil"
+ "io"
"net/http"
"net/http/httptest"
"os"
@@ -268,7 +268,7 @@ func Benchmark_Logger(b *testing.B) {
app.Use(New(Config{
Format: "${bytesReceived} ${bytesSent} ${status}",
- Output: ioutil.Discard,
+ Output: io.Discard,
}))
app.Get("/", func(c *fiber.Ctx) error {
return c.SendString("Hello, World!")
diff --git a/middleware/monitor/monitor_test.go b/middleware/monitor/monitor_test.go
index 7b73e295ed..661bed8373 100644
--- a/middleware/monitor/monitor_test.go
+++ b/middleware/monitor/monitor_test.go
@@ -3,7 +3,7 @@ package monitor
import (
"bytes"
"fmt"
- "io/ioutil"
+ "io"
"net/http/httptest"
"testing"
"time"
@@ -38,7 +38,7 @@ func Test_Monitor_Html(t *testing.T) {
utils.AssertEqual(t, 200, resp.StatusCode)
utils.AssertEqual(t, fiber.MIMETextHTMLCharsetUTF8,
resp.Header.Get(fiber.HeaderContentType))
- buf, err := ioutil.ReadAll(resp.Body)
+ buf, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, true, bytes.Contains(buf, []byte("
"+defaultTitle+"")))
timeoutLine := fmt.Sprintf("setTimeout(fetchJSON, %d)",
@@ -54,7 +54,7 @@ func Test_Monitor_Html(t *testing.T) {
utils.AssertEqual(t, 200, resp.StatusCode)
utils.AssertEqual(t, fiber.MIMETextHTMLCharsetUTF8,
resp.Header.Get(fiber.HeaderContentType))
- buf, err = ioutil.ReadAll(resp.Body)
+ buf, err = io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, true, bytes.Contains(buf, []byte(""+conf.Title+"")))
timeoutLine = fmt.Sprintf("setTimeout(fetchJSON, %d)",
@@ -74,7 +74,7 @@ func Test_Monitor_Html_CustomCodes(t *testing.T) {
utils.AssertEqual(t, 200, resp.StatusCode)
utils.AssertEqual(t, fiber.MIMETextHTMLCharsetUTF8,
resp.Header.Get(fiber.HeaderContentType))
- buf, err := ioutil.ReadAll(resp.Body)
+ buf, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, true, bytes.Contains(buf, []byte(""+defaultTitle+"")))
timeoutLine := fmt.Sprintf("setTimeout(fetchJSON, %d)",
@@ -94,7 +94,7 @@ func Test_Monitor_Html_CustomCodes(t *testing.T) {
utils.AssertEqual(t, 200, resp.StatusCode)
utils.AssertEqual(t, fiber.MIMETextHTMLCharsetUTF8,
resp.Header.Get(fiber.HeaderContentType))
- buf, err = ioutil.ReadAll(resp.Body)
+ buf, err = io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, true, bytes.Contains(buf, []byte(""+conf.Title+"")))
utils.AssertEqual(t, true, bytes.Contains(buf, []byte("https://cdnjs.com/libraries/Chart.js")))
@@ -121,7 +121,7 @@ func Test_Monitor_JSON(t *testing.T) {
utils.AssertEqual(t, 200, resp.StatusCode)
utils.AssertEqual(t, fiber.MIMEApplicationJSON, resp.Header.Get(fiber.HeaderContentType))
- b, err := ioutil.ReadAll(resp.Body)
+ b, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, true, bytes.Contains(b, []byte("pid")))
utils.AssertEqual(t, true, bytes.Contains(b, []byte("os")))
@@ -189,7 +189,7 @@ func Test_Monitor_APIOnly(t *testing.T) {
utils.AssertEqual(t, 200, resp.StatusCode)
utils.AssertEqual(t, fiber.MIMEApplicationJSON, resp.Header.Get(fiber.HeaderContentType))
- b, err := ioutil.ReadAll(resp.Body)
+ b, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, true, bytes.Contains(b, []byte("pid")))
utils.AssertEqual(t, true, bytes.Contains(b, []byte("os")))
diff --git a/middleware/pprof/pprof_test.go b/middleware/pprof/pprof_test.go
index 5779bb8eb2..ed0a41b5b1 100644
--- a/middleware/pprof/pprof_test.go
+++ b/middleware/pprof/pprof_test.go
@@ -2,7 +2,7 @@ package pprof
import (
"bytes"
- "io/ioutil"
+ "io"
"net/http/httptest"
"testing"
@@ -23,7 +23,7 @@ func Test_Non_Pprof_Path(t *testing.T) {
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, 200, resp.StatusCode)
- b, err := ioutil.ReadAll(resp.Body)
+ b, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "escaped", string(b))
}
@@ -42,7 +42,7 @@ func Test_Pprof_Index(t *testing.T) {
utils.AssertEqual(t, 200, resp.StatusCode)
utils.AssertEqual(t, fiber.MIMETextHTMLCharsetUTF8, resp.Header.Get(fiber.HeaderContentType))
- b, err := ioutil.ReadAll(resp.Body)
+ b, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, true, bytes.Contains(b, []byte("/debug/pprof/")))
}
diff --git a/middleware/proxy/proxy_test.go b/middleware/proxy/proxy_test.go
index 47ec14a5fd..595a46ff66 100644
--- a/middleware/proxy/proxy_test.go
+++ b/middleware/proxy/proxy_test.go
@@ -2,7 +2,7 @@ package proxy
import (
"crypto/tls"
- "io/ioutil"
+ "io"
"net"
"net/http"
"net/http/httptest"
@@ -174,7 +174,7 @@ func Test_Proxy_Forward(t *testing.T) {
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, fiber.StatusOK, resp.StatusCode)
- b, err := ioutil.ReadAll(resp.Body)
+ b, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "forwarded", string(b))
}
@@ -234,7 +234,7 @@ func Test_Proxy_Modify_Response(t *testing.T) {
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, fiber.StatusOK, resp.StatusCode)
- b, err := ioutil.ReadAll(resp.Body)
+ b, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "modified response", string(b))
}
@@ -261,7 +261,7 @@ func Test_Proxy_Modify_Request(t *testing.T) {
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, fiber.StatusOK, resp.StatusCode)
- b, err := ioutil.ReadAll(resp.Body)
+ b, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "modified request", string(b))
}
@@ -285,7 +285,7 @@ func Test_Proxy_Timeout_Slow_Server(t *testing.T) {
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, fiber.StatusOK, resp.StatusCode)
- b, err := ioutil.ReadAll(resp.Body)
+ b, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "fiber is awesome", string(b))
}
@@ -309,7 +309,7 @@ func Test_Proxy_With_Timeout(t *testing.T) {
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, fiber.StatusInternalServerError, resp.StatusCode)
- b, err := ioutil.ReadAll(resp.Body)
+ b, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "timeout", string(b))
}
@@ -388,7 +388,7 @@ func Test_Proxy_Do_HTTP_Prefix_URL(t *testing.T) {
resp, err := app.Test(httptest.NewRequest(http.MethodGet, "/http://"+addr, nil))
utils.AssertEqual(t, nil, err)
- s, err := ioutil.ReadAll(resp.Body)
+ s, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "hello world", string(s))
}
diff --git a/mount_test.go b/mount_test.go
index 1fa9135914..deee3ad4c5 100644
--- a/mount_test.go
+++ b/mount_test.go
@@ -6,7 +6,7 @@ package fiber
import (
"errors"
- "io/ioutil"
+ "io"
"net/http/httptest"
"testing"
@@ -216,7 +216,7 @@ func Test_App_UseMountedErrorHandlerForBestPrefixMatch(t *testing.T) {
utils.AssertEqual(t, nil, err, "/api/sub req")
utils.AssertEqual(t, 200, resp.StatusCode, "Status code")
- b, err := ioutil.ReadAll(resp.Body)
+ b, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err, "iotuil.ReadAll()")
utils.AssertEqual(t, "hi, i'm a custom sub fiber error", string(b), "Response body")
@@ -224,7 +224,7 @@ func Test_App_UseMountedErrorHandlerForBestPrefixMatch(t *testing.T) {
utils.AssertEqual(t, nil, err, "/api/sub/third req")
utils.AssertEqual(t, 200, resp.StatusCode, "Status code")
- b, err = ioutil.ReadAll(resp2.Body)
+ b, err = io.ReadAll(resp2.Body)
utils.AssertEqual(t, nil, err, "iotuil.ReadAll()")
utils.AssertEqual(t, "hi, i'm a custom sub sub fiber error", string(b), "Third fiber Response body")
}
@@ -250,7 +250,7 @@ func Test_Ctx_Render_Mount(t *testing.T) {
utils.AssertEqual(t, StatusOK, resp.StatusCode, "Status code")
utils.AssertEqual(t, nil, err, "app.Test(req)")
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "Hello a!
", string(body))
}
@@ -302,7 +302,7 @@ func Test_Ctx_Render_Mount_ParentOrSubHasViews(t *testing.T) {
utils.AssertEqual(t, StatusOK, resp.StatusCode, "Status code")
utils.AssertEqual(t, nil, err, "app.Test(req)")
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "Hello a!
", string(body))
@@ -310,7 +310,7 @@ func Test_Ctx_Render_Mount_ParentOrSubHasViews(t *testing.T) {
utils.AssertEqual(t, StatusOK, resp.StatusCode, "Status code")
utils.AssertEqual(t, nil, err, "app.Test(req)")
- body, err = ioutil.ReadAll(resp.Body)
+ body, err = io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "Hello, World!
", string(body))
@@ -318,7 +318,7 @@ func Test_Ctx_Render_Mount_ParentOrSubHasViews(t *testing.T) {
utils.AssertEqual(t, StatusOK, resp.StatusCode, "Status code")
utils.AssertEqual(t, nil, err, "app.Test(req)")
- body, err = ioutil.ReadAll(resp.Body)
+ body, err = io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "I'm Bruh
", string(body))
@@ -345,7 +345,7 @@ func Test_Ctx_Render_MountGroup(t *testing.T) {
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, 200, resp.StatusCode, "Status code")
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, "Hello doe!
", string(body))
}
diff --git a/prefork_test.go b/prefork_test.go
index 22dcfa6f68..e61780f2cd 100644
--- a/prefork_test.go
+++ b/prefork_test.go
@@ -6,7 +6,7 @@ package fiber
import (
"crypto/tls"
- "io/ioutil"
+ "io"
"os"
"testing"
"time"
@@ -83,7 +83,7 @@ func Test_App_Prefork_Child_Process_Never_Show_Startup_Message(t *testing.T) {
utils.AssertEqual(t, nil, w.Close())
- out, err := ioutil.ReadAll(r)
+ out, err := io.ReadAll(r)
utils.AssertEqual(t, nil, err)
utils.AssertEqual(t, 0, len(out))
}
diff --git a/router_test.go b/router_test.go
index d8a8c323f4..eceae1fd5b 100644
--- a/router_test.go
+++ b/router_test.go
@@ -10,8 +10,9 @@ import (
"encoding/json"
"errors"
"fmt"
- "io/ioutil"
+ "io"
"net/http/httptest"
+ "os"
"strings"
"testing"
@@ -22,7 +23,7 @@ import (
var routesFixture = routeJSON{}
func init() {
- dat, err := ioutil.ReadFile("./.github/testdata/testRoutes.json")
+ dat, err := os.ReadFile("./.github/testdata/testRoutes.json")
if err != nil {
panic(err)
}
@@ -42,7 +43,7 @@ func Test_Route_Match_SameLength(t *testing.T) {
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, 200, resp.StatusCode, "Status code")
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, ":param", app.getString(body))
@@ -51,7 +52,7 @@ func Test_Route_Match_SameLength(t *testing.T) {
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, 200, resp.StatusCode, "Status code")
- body, err = ioutil.ReadAll(resp.Body)
+ body, err = io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, "test", app.getString(body))
}
@@ -67,7 +68,7 @@ func Test_Route_Match_Star(t *testing.T) {
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, 200, resp.StatusCode, "Status code")
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, "*", app.getString(body))
@@ -76,7 +77,7 @@ func Test_Route_Match_Star(t *testing.T) {
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, 200, resp.StatusCode, "Status code")
- body, err = ioutil.ReadAll(resp.Body)
+ body, err = io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, "test", app.getString(body))
@@ -113,7 +114,7 @@ func Test_Route_Match_Root(t *testing.T) {
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, 200, resp.StatusCode, "Status code")
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, "root", app.getString(body))
}
@@ -131,7 +132,7 @@ func Test_Route_Match_Parser(t *testing.T) {
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, 200, resp.StatusCode, "Status code")
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, "bar", app.getString(body))
@@ -140,7 +141,7 @@ func Test_Route_Match_Parser(t *testing.T) {
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, 200, resp.StatusCode, "Status code")
- body, err = ioutil.ReadAll(resp.Body)
+ body, err = io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, "test", app.getString(body))
}
@@ -156,7 +157,7 @@ func Test_Route_Match_Middleware(t *testing.T) {
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, 200, resp.StatusCode, "Status code")
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, "*", app.getString(body))
@@ -165,7 +166,7 @@ func Test_Route_Match_Middleware(t *testing.T) {
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, 200, resp.StatusCode, "Status code")
- body, err = ioutil.ReadAll(resp.Body)
+ body, err = io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, "bar/fasel", app.getString(body))
}
@@ -181,7 +182,7 @@ func Test_Route_Match_UnescapedPath(t *testing.T) {
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, StatusOK, resp.StatusCode, "Status code")
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, "test", app.getString(body))
// without special chars
@@ -217,7 +218,7 @@ func Test_Route_Match_WithEscapeChar(t *testing.T) {
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, StatusOK, resp.StatusCode, "Status code")
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, "static", app.getString(body))
@@ -226,7 +227,7 @@ func Test_Route_Match_WithEscapeChar(t *testing.T) {
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, StatusOK, resp.StatusCode, "Status code")
- body, err = ioutil.ReadAll(resp.Body)
+ body, err = io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, "group", app.getString(body))
@@ -235,7 +236,7 @@ func Test_Route_Match_WithEscapeChar(t *testing.T) {
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, StatusOK, resp.StatusCode, "Status code")
- body, err = ioutil.ReadAll(resp.Body)
+ body, err = io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, "awesome", app.getString(body))
}
@@ -251,7 +252,7 @@ func Test_Route_Match_Middleware_HasPrefix(t *testing.T) {
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, 200, resp.StatusCode, "Status code")
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, "middleware", app.getString(body))
}
@@ -267,7 +268,7 @@ func Test_Route_Match_Middleware_Root(t *testing.T) {
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, 200, resp.StatusCode, "Status code")
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, "middleware", app.getString(body))
}
@@ -339,7 +340,7 @@ func Test_Route_Static_Root(t *testing.T) {
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, 200, resp.StatusCode, "Status code")
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, true, strings.Contains(app.getString(body), "color"))
@@ -354,7 +355,7 @@ func Test_Route_Static_Root(t *testing.T) {
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, 200, resp.StatusCode, "Status code")
- body, err = ioutil.ReadAll(resp.Body)
+ body, err = io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, true, strings.Contains(app.getString(body), "color"))
}
@@ -378,7 +379,7 @@ func Test_Route_Static_HasPrefix(t *testing.T) {
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, 200, resp.StatusCode, "Status code")
- body, err := ioutil.ReadAll(resp.Body)
+ body, err := io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, true, strings.Contains(app.getString(body), "color"))
@@ -399,7 +400,7 @@ func Test_Route_Static_HasPrefix(t *testing.T) {
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, 200, resp.StatusCode, "Status code")
- body, err = ioutil.ReadAll(resp.Body)
+ body, err = io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, true, strings.Contains(app.getString(body), "color"))
@@ -418,7 +419,7 @@ func Test_Route_Static_HasPrefix(t *testing.T) {
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, 200, resp.StatusCode, "Status code")
- body, err = ioutil.ReadAll(resp.Body)
+ body, err = io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, true, strings.Contains(app.getString(body), "color"))
@@ -437,7 +438,7 @@ func Test_Route_Static_HasPrefix(t *testing.T) {
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, 200, resp.StatusCode, "Status code")
- body, err = ioutil.ReadAll(resp.Body)
+ body, err = io.ReadAll(resp.Body)
utils.AssertEqual(t, nil, err, "app.Test(req)")
utils.AssertEqual(t, true, strings.Contains(app.getString(body), "color"))
}