1
0
mirror of https://github.com/gofiber/fiber.git synced 2025-02-07 02:12:12 +00:00

26 Commits

Author SHA1 Message Date
Juan Calderon-Perez
3209052305
chore: Update golangci-lint to v1.57.1 (#2929)
* Update linter.yml

* Fix issues from golangci-lint v1.57.1
2024-03-24 20:32:13 +01:00
leonklingele
5449b04101
feat: make golangci-lint config stricter (#2874) 2024-03-17 13:46:20 +01:00
Juan Calderon-Perez
0379cc59aa
fix: Inconsistent and flaky unit-tests (#2892)
* Fixes for some of the failing tests

* Add readiness check to serverStart()

* Use net/http client for tests listen test

* Use different key for this test

* Run Proxy Middleware tests in parallel. Add nil checks for potential issues pointed by nilaway

* Enable parallel client tests

* Do not run timing sensitive tests in parallel

* Remove TODO

* Revert Test_Proxy_DoTimeout_Timeout, and remove t.Parallel() for it

* Do not calculate favicon len on each handler call

* Revert logic change

* Increase timeout of SaveFile tests

* Do not run time sensitive tests in parallel

* The Agent can't be run in parallel

* Do not run time sensitive tests in parallel

* Fixes based on uber/nilaway

* Revert change to Client test

* Run parallel

* Update client_test.go

* Update client_test.go

* Update cache_test.go

* Update cookiejar_test.go

* Remove parallel for test using timeouts

* Remove t.Parallel() from logger middleware tests

* Do not use testify.require in a goroutine

* Fix import, and update golangci-lint

* Remove changes to template_chain.go

* Run more tests in parallel

* Add more parallel tests

* Add more parallel tests

* SetLogger can't run in parallel

* Run more tests in parallel, fix issue with goroutine in limiter middleware

* Update internal/storage/memory, add more benchmarks

* Increase sleep for csrf test by 100 milliseconds. Implement asserted and parallel benchmarks for Session middleware

* Add 100 milliseconds to sleep during test

* Revert name change

* fix: Inconsistent and flaky unit-tests

* fix: Inconsistent and flaky unit-tests

* fix: Inconsistent and flaky unit-tests

* fix: Inconsistent and flaky unit-tests

* fix: Inconsistent and flaky unit-tests

* fix: Inconsistent and flaky unit-tests

* fix: Inconsistent and flaky unit-tests

* fix: Inconsistent and flaky unit-tests

* fix: Inconsistent and flaky unit-tests

* fix: Inconsistent and flaky unit-tests

---------

Co-authored-by: M. Efe Çetin <efectn@protonmail.com>
Co-authored-by: René <rene@gofiber.io>
2024-03-08 20:03:13 +01:00
Jinquan Wang
b38be4bcb3
v3 (feature): client refactor (#1986)
*  v3: Move the client module to the client folder and fix the error

*  v3: add xml encoder and decoder

* 🚧 v3: design plugin and hook mechanism, complete simple get request

* 🚧 v3: reset add some field

* 🚧 v3: add doc and fix some error

* 🚧 v3: add header merge

* 🚧 v3: add query param

* 🚧 v3: change to fasthttp's header and args

*  v3: add body and ua setting

* 🚧 v3: add cookie support

* 🚧 v3: add path param support

*  v3: fix error test case

* 🚧 v3: add formdata and file support

* 🚧 v3: referer support

* 🚧 v3: reponse unmarshal

*  v3: finish API design

* 🔥 v3: remove plugin mechanism

* 🚧 v3: add timeout

* 🚧 v3: change path params pattern and add unit test for core

* ✏️ v3: error spell

*  v3: improve test coverage

*  perf: change test func name to fit project format

* 🚧 v3: handle error

* 🚧 v3: add unit test and fix error

* ️ chore: change func to improve performance

*  v3: add some unit test

*  v3: fix error test

* 🐛 fix: add cookie to response

*  v3: add unit test

*  v3: export raw field

* 🐛 fix: fix data race

* 🔒️ chore: change package

* 🐛 fix: data race

* 🐛 fix: test fail

*  feat: move core to req

* 🐛 fix: connection reuse

* 🐛 fix: data race

* 🐛 fix: data race

* 🔀 fix: change to testify

*  fix: fail test in windows

*  feat: response body save to file

*  feat: support tls config

* 🐛 fix: add err check

* 🎨 perf: fix some static check

*  feat: add proxy support

*  feat: add retry feature

* 🐛 fix: static check error

* 🎨 refactor: move som code

* docs: change readme

*  feat: extend axios API

* perf: change field to export field

*  chore: disable startup message

* 🐛 fix: fix test error

* chore: fix error test

* chore: fix test case

* feat: add some test to client

* chore: add test case

* chore: add test case

*  feat: add peek for client

*  chore: add test case

* ️ feat: lazy generate rand string

* 🚧 perf: add config test case

* 🐛 fix: fix merge error

* 🐛 fix utils error

*  add redirection

* 🔥 chore: delete deps

* perf: fix spell error

* 🎨 perf: spell error

*  feat: add logger

*  feat: add cookie jar

*  feat: logger with level

* 🎨 perf: change the field name

* perf: add jar test

* fix proxy test

* improve test coverage

* fix proxy tests

* add cookiejar support from pending fasthttp PR

* fix some lint errors.

* add benchmark for SetValWithStruct

* optimize

* update

* fix proxy middleware

* use panicf instead of errorf and fix panic on default logger

* update

* update

* cleanup comments

* cleanup comments

* fix golang-lint errors

* Update helper_test.go

* add more test cases

* add hostclient pool

* make it more thread safe
-> there is still something which is shared between the requests

* fixed some golangci-lint errors

* fix Test_Request_FormData test

* create new test suite

* just create client for once

* use random port instead of 3000

* remove client pooling and fix test suite

* fix data races on logger tests

* fix proxy tests

* fix global tests

* remove unused code

* fix logger test

* fix proxy tests

* fix linter

* use lock instead of rlock

* fix cookiejar data-race

* fix(client): race conditions

* fix(client): race conditions

* apply some reviews

* change client property name

* apply review

* add parallel benchmark for simple request

* apply review

* apply review

* fix log tests

* fix linter

* fix(client): return error in SetProxyURL instead of panic

---------

Co-authored-by: Muhammed Efe Çetin <efectn@protonmail.com>
Co-authored-by: René Werner <rene.werner@verivox.com>
Co-authored-by: Joey <fenny@gofiber.io>
Co-authored-by: René <rene@gofiber.io>
2024-03-04 08:49:14 +01:00
Juan Calderon-Perez
9dabf96ddc
Bump golangci-lint to v1.56.1 (#2842)
* Update linter.yml

* Disable spancheck, fix some of the errors

* Fix ErrorAs, disable go-require from testifylint

* Remove extra space

* Fix all warnings from golangci-lint and revive unused params

* Refactor CopyContextToFiberContext

* Update adaptor.go
2024-02-13 08:23:15 +01:00
Martin Hotmann
573afb953d
Update startup message formatting (#2847)
* Update listen.go (unform INFO prints at startip + cosmetics)

BEFORE:
```
    _______ __             
   / ____(_) /_  ___  _____
  / /_  / / __ \/ _ \/ ___/
 / __/ / / /_/ /  __/ /    
/_/   /_/_.___/\___/_/     v3.0.0-beta.1
--------------------------------------------------
INFO Server started on http://127.0.0.1:8003 (bound on host 0.0.0.0 and port 8003)
INFO Application name: TEST APP
INFO Total handlers count: 5
INFO Prefork: Disabled
INFO PID: 2342
INFO Total process count: 1
20:49:50 | 200 |     593.769µs |   123.123.123.123 | GET     | / 
```

AFTER:
```
    _______ __             
   / ____(_) /_  ___  _____
  / /_  / / __ \/ _ \/ ___/
 / __/ / / /_/ /  __/ /    
/_/   /_/_.___/\___/_/     v3.0.0-beta.1
--------------------------------------------------
INFO Server started on:      http://127.0.0.1:8003 (bound on host 0.0.0.0 and port 8003)
INFO Application name:       TEST APP
INFO Total handlers count:   5
INFO Prefork:                Disabled
INFO PID:                    2342
INFO Total process count:    1

20:49:50 | 200 |     593.769µs |   123.123.123.123 | GET     | /
```

* fix spacer

* fix indentation for fiber version

* fix linting

* fix linting #2

* fix listen_test.go to match newly expected output.

* fix test again

---------

Co-authored-by: root <root@clicon.hosting-hotmann.de>
Co-authored-by: Martin <martin@hotmann.de>
2024-02-10 21:55:04 +01:00
nickajacks1
3c4509f054
chore: Fix remaining testifylint errors (#2806) 2024-01-22 08:34:15 +01:00
Muhammed Efe Çetin
41866cd3dd
👷 v3 (ci): fix some linter warnings 2023-03-06 17:35:39 +03:00
Muhammed Efe Çetin
3168a60605
👷 v3 (ci): fix some linter warnings 2023-02-09 23:15:21 +03:00
Muhammed Efe Çetin
c2749c36c2
👷 v3 (ci): fix some linter warnings 2023-02-09 22:33:45 +03:00
Muhammed Efe Çetin
088cde594d
Merge remote-tracking branch 'origin/master' into v3-beta 2023-02-05 23:43:42 +03:00
leonklingele
167a8b5e94
🚀 Feature: Add and apply more stricter golangci-lint linting rules (#2286)
* golangci-lint: add and apply more stricter linting rules

* github: drop security workflow now that we use gosec linter inside golangci-lint

* github: use official golangci-lint CI linter

* Add editorconfig and gitattributes file
2023-01-27 09:01:37 +01:00
M. Efe Çetin
5406560033
🧹 chore: make most tests parallel (#2299)
* 🧹 chore: make most tests parallel

* revert some tests

* revert some tests

* revert some tests
2023-01-15 23:21:37 +08:00
Gökhan Özeloğlu
1a7f7ed8a9
v3: Change startup message (#2041)
* Add figlet text for Fiber startup message

* Fiber figlet text is added to beginning of the startup message.

Signed-off-by: Gökhan Özeloğlu <gokhan.ozeloglu@deliveryhero.com>

* Refactor startup message

* Table is removed. Logs are added.

* Test cases refactored.

Signed-off-by: Gökhan Özeloğlu <gokhan.ozeloglu@deliveryhero.com>

* Add colorful log messages

* Used custom color codes to make logs colorful.

* Added a new test case.

* Fixed broken test case after changes.

* Added some color codes as a variable.

* Handled Windows case with init() function. Color codes are set empty string.

Signed-off-by: Gökhan Özeloğlu <gokhan.ozeloglu@deliveryhero.com>

* Change color text logic

* Color codes are taken from config.

* Version is added to figlet text.

* Reordered "server started on" message.

* Test cases are refactored.

Signed-off-by: Gökhan Özeloğlu <gokhan.ozeloglu@deliveryhero.com>

* Add if condition for Windows

* OS checked in tests for Windows machines.

Signed-off-by: Gökhan Özeloğlu <gokhan.ozeloglu@deliveryhero.com>

* some improvements

* Fix startup message tests

Signed-off-by: Gökhan Özeloğlu <gokhan.ozeloglu@deliveryhero.com>

* colorize PIDs

Signed-off-by: Gökhan Özeloğlu <gokhan.ozeloglu@deliveryhero.com>
Co-authored-by: Muhammed Efe Çetin <efectn@protonmail.com>
2022-09-15 09:53:07 +02:00
M. Efe Çetin
281e2f0046
v3 (feature): merge Listen methods & ListenConfig (#1930)
*  v3: new Start method for app

*  v3: new Start method for app

*  v3: new Start method for app

*  v3: new Start method for app

*  v3: new Start method for app

*  v3: new Start method for app

* fix tests

* improve graceful shutdown

* update

* Start -> Listen

* rename test funcs.

* Add Test_Listen_Graceful_Shutdown test.

* add OnShutdownSuccess

* fix tests

* fix tests

* split listen & listener

* typo

* Add retry logic to tests

* Add retry logic to tests

* Add retry logic to tests

* Add retry logic to tests

Co-authored-by: René Werner <rene@gofiber.io>
2022-09-08 07:57:05 +02:00
Muhammed Efe Çetin
319b8ea3a8
Merge remote-tracking branch 'origin/master' into v3-beta 2022-09-03 23:56:45 +03:00
M. Efe Çetin
cbfcac2c0a
🐛 bug: remove prefork support from custom listeners (#2060)
* 🐛 bug: remove prefork support from custom listeners

* Update listen_test.go
2022-08-30 13:01:24 +02:00
Amir Hossein
349772d69a
fix unhandled errors and remove unused parameter (#2061)
* fix unhandled errors

* fix unhandled error in cache package test

* omit variable type

* omit variable type

* rename variable because collide with the imported package name

* handle file error on closing

* fix unhandled in common_linux.go

* fix unhandled errors in helpers_test.go

* fix unhandled errors in listen_test.go

* remove unused parameter in emptyHandler method
2022-08-30 08:38:16 +02:00
Trim21
c964fda009
v3(tests): use testify for assertion (#2036)
* replace

* write

* rewrite more

* rewrite

* rewrite

* fix

* rewrite
2022-08-22 07:57:10 +02:00
Muhammed Efe Çetin
4105b008c2
Merge remote-tracking branch 'origin/master' into v3-beta 2022-08-19 14:33:31 +03:00
Maxi_Mega
e49880c5d6
🎨 Fix padding around app name in startup message when containing non-ascii characters (#1987)
* Fix padding around app name in startup message when it contains non-ascii characters

* fix conflict, allow ending space only for odd length strings

* move startup message tests to listen_test.go
2022-08-01 13:16:49 +03:00
M. Efe Çetin
4103f9463d
feature: customizable colors (#1977)
*  feature: customizable colors

*  feature: customizable colors

*  feature: customizable colors
2022-08-01 08:24:37 +02:00
Fenny
1e7df547ba Clean up repository 2020-02-10 01:24:59 +01:00
Vic Shóstak
397ece3d24 Fix GolangCI issues, Draft new README 2020-02-07 22:28:18 +03:00
Fenny
cd8803f818 Disable listen_test.go for now 2020-02-07 00:43:16 +01:00
Fenny
885605b873 Add Shutdown
Shutsdown server gracefully
2020-02-07 00:27:50 +01:00