Commit Graph

197 Commits (helmet-docs)

Author SHA1 Message Date
Jinquan Wang 093882cfdf
v3 (feature): new Route method (#2065)
* 🎨 perf: change name to add new feature

*  feat add route

* 🎨 perf: rollback name

* 🎨 perf: change file name

* fix: fix errors caused by register

* 🎨 perf: change filed to private and change comment

* feat: interface is better

* 🎨 perf: change type name

* deeper tests

Co-authored-by: Muhammed Efe Çetin <efectn@protonmail.com>
2022-09-18 11:35:57 +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
Jinquan Wang e8c93e6153
🐛 [Fix]: unhandle in strictmode (#2055)
* fix: unhandle in strictmode

* 🐛 fix: error test

*  chore: add testcases for strictrouting

*  chore: fix test case
2022-09-07 11:05:37 +02:00
Muhammed Efe Çetin 78c6197430
♻️ v3 (enhancement): remove automatic HEAD method creation from Get()
ref: https://github.com/gofiber/fiber/issues/2026
2022-09-05 17:41:39 +03:00
Amir Hossein c8b1879b11
fix unhandled errors in app_test.go (#2071)
* 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

* refactor path.go

* unhandled error in hooks test

* fix unhandled errors in app_test.go

* fix unhandled errors in ctx_test.go

*  fix unhandled errors in helpers_test.go

* revert app_test.go
2022-09-05 13:11:09 +02:00
Amir Hossein 01ea139da4
🔎 fix unhandled errors (#2048)
fix unhandled errors
2022-08-26 12:02:46 +02:00
M. Efe Çetin 4d28b1e200
🐛 bug: make tlsHandler public to use it with Listener (#2034)
* 🐛 bug: ClientHelloInfo support for app.Listener

* 🐛 bug: ClientHelloInfo support for app.Listener

* fix

* make tlshandler public

* update

* 🐛 bug: make tlsHandler public to use it with Listener #2034

Co-authored-by: wernerr <rene@gofiber.io>
2022-08-24 09:47:37 +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
Muhammed Efe Çetin 28f1df4246
v3: fix `Benchmark_AcquireCtx` benchmark 2022-08-15 18:27:06 +03:00
M. Efe Çetin 41159296f3
v3: revert " v3 (feature): use any as default Message type of Error struct (#1925)" (#2000)
Revert " v3 (feature): use any as default Message type of Error struct (#1925)"
2022-08-08 08:21:00 +02:00
Trim21 e5eb8d3c98
fix infinitely `app.Test` (#1997)
* diff

* better code

* err message

* code style

* up

* fix type error

* use time.Timer
2022-08-08 08:18:57 +02:00
wernerr 1cca495c7b try to stabilize Test_Test_Timeout 2022-08-02 08:31:22 +02: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
M. Efe Çetin a458bd344c
v3 (feature): convert fiber.Ctx type to interface (#1928)
*  v3: convert fiber.Ctx type to interface

* update ctx methods

* add new methods to customize ctx, fix some problems

* update comments.

* fix something
2022-07-13 07:48:29 +02:00
M. Efe Çetin dac929fdee
🧹 client: remove beta warning (#1951)
* 🧹 client: remove beta warning

* Stabilize the Test_Test_Timeout unittest

Co-authored-by: wernerr <rene@gofiber.io>
2022-07-04 07:50:37 +02:00
M. Efe Çetin e35a594cf1
v3 (feature): use any as default Message type of Error struct (#1925)
*  v3: use any as default Message type of Error struct.

*  v3: use any as default Message type of Error struct.

*  v3: use any as default Message type of Error struct.

*  v3: use any as default Message type of Error struct.
2022-06-12 18:37:23 +02:00
Muhammed Efe Çetin f119794035
v3: replace io/ioutil by io and os, update version constant 2022-06-01 18:34:22 +03:00
Muhammed Efe Çetin edd89de2d6
v3: remove deprecations 2022-05-31 17:50:31 +03:00
Muhammed Efe Çetin c7f45ec38e
v3: replace interface{}s by any 2022-05-31 17:41:38 +03:00
Muhammed Efe Çetin 1188144d78
🎉 v3: init 2022-05-31 17:35:49 +03:00
RW a8f9d4acfb
🐛 Sub fiber's error handlers not working #1839 (#1848)
fix root level bug
2022-04-05 08:40:22 +02:00
akp e974c6793f
RFC: Return an instance of `*fiber.Error` when no handler found (#1847)
* Return an instance of `*fiber.Error` when no handler found

When a handler cannot be found for a given path, previously Fiber
would construct a plaintext response that cannot be modified.

This commit switches to returning a new instance of `*fiber.Error`
with identical error message so that users can customise the look
of their 404 pages.

Signed-off-by: AKP <tom@tdpain.net>

* Fix `Test_App_Next_Method`

This test was failing as the error returned by `c.Next()` that's
required to generate the correct 404 status code was not being
passed through the middleware and being silently ignored.

Signed-off-by: AKP <tom@tdpain.net>

* Fix `Test_Logger_All`

Signed-off-by: AKP <tom@tdpain.net>

* Fix `Test_Cache_WithHeadThenGet` test

As far as I can tell, this test is meant to check that a cached
HEAD request to a given endpoint does not return the cached
content to a GET request to the same endpoint, and the test has
been altered to correctly check for this.

Signed-off-by: AKP <tom@tdpain.net>
2022-04-05 08:39:53 +02:00
M. Efe Çetin a7032b7a17
Update TLS Config & Add ListenMutualTLS (#1761)
* deprecations

* Add mTLS support.

* update

* update

* Update app.go
2022-02-24 08:01:42 +01:00
Eren BALCI 74a20b4589
🩹 fix: backwards incompatible change to fiber.Error (#1768)
* fix: backwards incompatible change to fiber.Error

* revert: work backward compatible
2022-02-14 08:17:04 +01:00
M. Efe Çetin 937713e41e
feature: bind support for render (#1754)
* Bind support for Render.

* update

* fix tests

* split Pass-locals-to-views & Bind from Render

* update comments.

* add benchs.

* Update ctx.go

Co-authored-by: hi019 <65871571+hi019@users.noreply.github.com>

* Update ctx.go

* optimize

* switch dictpool.

*  feature: bind support for render
- improve performance

*  feature: bind support for render
- improve performance

Co-authored-by: hi019 <65871571+hi019@users.noreply.github.com>
Co-authored-by: wernerr <rene.werner@verivox.com>
Co-authored-by: wernerr <rene@gofiber.io>
2022-02-12 22:52:24 +01:00
Lian af10fab05b
Add direct download option when serving static files (#1729)
* enable download for app.Static


wording

* Add unit test.

Co-authored-by: Muhammed Efe Çetin <efectn@protonmail.com>
2022-02-03 14:41:45 +01:00
M. Efe Çetin d3c2122086
Fix route naming when to use group in group. (#1736) 2022-01-29 15:26:01 +01:00
Eren BALCI 7cf1886df5
Fix NewErrors() and Improve NewError() (#1728)
* fix new errors

* fix tests

* removed new errors tests

* changed error message type

* fixed NewError test

* added NewErrors function

* added Test_NewErrors

* added comment line

* refactor: Sprintf changed with Sprint
2022-01-27 12:41:10 +01:00
M. Efe Çetin 559f59f198
Add Route() method like Chi router. (#1713) 2022-01-24 16:37:28 +01:00
vecpeng 5fe95c2579
feat: add function NewErrors to create multiple new errors (#1701) 2022-01-10 14:22:34 +01:00
vecpeng f98a9ba405
feature: print all routes message when server starts (#1677)
* feature: print all routes message when server starts

* feature: print all routes message when server starts

* feature:  print all routes message when server starts

* 🐛fix: errors unhandled

* 🐛fix: ignore child process and add some "-" to the table head

* 🐛fix: add printRoutesMessage for listener and listenTLS
2021-12-30 14:13:31 +01:00
vecpeng ef3a689600
🐛fix: rename handlerCount to handlersCount (#1674) 2021-12-29 10:26:50 +01:00
M. Efe Çetin fbee8fb274
Add method the get registered handler count. (#1672) 2021-12-29 07:23:14 +01:00
ichx 637f0c1bba
Fix: error handler of app and its sub apps not saved when mounted in group (#1649) 2021-12-28 14:05:35 +01:00
M. Efe Çetin 68d3b773bc
Add route naming feature. (#1650)
* Add route naming feature.

* Update basicauth_test.go

* Fix gosec issues.

* Change RoutaName -> Name

* Fix race conditions.

* Update READMEs.
2021-12-28 14:04:04 +01:00
Gusted 7b7dcf29f7
♻️ Tidy up the codebase (#1613)
* run gofmt

* add t.Helper()

* Simplify assigns

* Simplify make operation

* Remove unused field in struct

* Fix typo

* Run gofumpt ./

* Consistent spacing

* len(...) can never be negative

* Use ReplaceAll

* Simplify operation

* Remove deadcode

* Fix typo

* Tidy up `} else { if ...`

* Fix AssertEqual

* Remove t.Helper() to fix go1.14.15
2021-11-05 08:00:03 +01:00
Jose Garcia 587f3ae9df
Support for sub fiber's error handlers (#1560)
- Mounted fiber and its sub apps error handlers are now saved a new
  errorHandlers map in App
- New public App.ErrorHandler method that wraps the logic for which
  error handler to user on any given context
- Error handler match logic based on request path <=> prefix accuracy
- Typo fixes
- Tests
2021-10-05 14:03:20 +02:00
Fufu 2c6ffb7972
Fix: register static file routing with trailing slash (#1556) 2021-10-05 10:55:11 +02:00
Fufu b94870d886
Fix: static file routing path rewrite. (#1538)
* Fix: static file routing path rewrite.

* Add: static file routing test cases.

* Update: change os.CreateTemp to ioutil.TempFile for go1.14

* Update: optimize test cases.
2021-10-01 12:51:48 +02:00
RW a0b1f38d3e
Improve startup message tests (#1504)
* improve startup message tests
2021-08-22 10:58:16 +02:00
RW 4b62cfbb61
Add test run for go1.17 (#1501)
* Add test run for go1.17

default type for yaml is changed to „application/x-yaml"
-> instead of the yaml´s we use the html and json files for the test
2021-08-22 09:48:07 +02:00
Sujit Baniya 8ab5c657c6
🔥 FEATURE: Allow adding App Name to customizing the startup message (#1418)
* Add Global Layout for view render

* Add test case for Views Layout

* Update ctx_test.go

* Add App Name function to pass custom app name

* Remove json tag for function

* Change func to string

* Add test for AppName

Co-authored-by: RW <rene@gofiber.io>
2021-07-16 08:44:11 +02:00
Troy 08b2b71197
Add support for streaming the request body. (#1423)
* update fasthttp

* allow req body streaming

* multipart form streaming

* update fasthttp

* allow req body streaming

* multipart form streaming

* Testing
2021-07-11 11:45:46 +02:00
wernerr d7ca1efd13 fix error after deleting the stale yaml 2021-05-28 09:40:48 +02:00
kiyon 22848f7e31
👷 Add testcases for ListenTLS (#1320) 2021-05-07 09:24:48 +02:00
Diego Sandrim 0dc67e80d2 Moves .getBytes and .getString from package variable to App instance variable, avoiding data race when creating a new App. 2021-05-05 17:24:26 -03:00
Diego Sandrim 24f55ef580 Adds a test to detect data race in .New and .Test funcs 2021-05-05 16:43:07 -03:00
bestgopher 056c6808af
Use atomic instead of mutex when counting the route handler. (#1314)
* use atomic instead of mutex when counting

* 📒 router: fix typo error
2021-05-05 17:53:54 +02:00
Dario Leittersdorf a28afaae75
🩹Fix: Startup message doesn't show correct amount of Handlers after mounting (#1302)
* fix: pass handlerCount when mounting to an App

* test: check for correct handlerCount after mounting an instance

* fix: pass handlerCount when mounting to a Group

* test: check for correct handlerCount after mounting to a Group

Co-authored-by: dleitter <dario.leittersdorf@bonprix.net>
2021-05-04 09:21:04 +02:00
Kiyon b46185e1b0 👷 Fix hardcode tls to startupMessage in app.Listener 2021-02-23 16:40:17 +08:00
Kiyon 00dbdd5fb3 👷 Add network type constant 2021-02-08 11:35:17 +08:00
Martin Lukasik 0b88c808e5 add test case for App_Static_Next 2021-01-23 08:31:45 +01:00
ReneWerner87 d4bbd08bbb 🐛 UnescapePath not working #1102
change arabic test string to test

Co-authored-by: Fenny <fenny@gofiber.io>
2021-01-06 13:52:34 +01:00
ReneWerner87 4f5e57d8de 🐛 UnescapePath not working #1102
Co-authored-by: Fenny <fenny@gofiber.io>
2021-01-06 13:46:50 +01:00
ReneWerner87 b51def0bb8 🐛 UnescapePath not working #1102
Co-authored-by: Fenny <fenny@gofiber.io>
2021-01-06 13:21:54 +01:00
Kiyon 7c88fa41e0 👷 Add test cases for group router empty prefix path 2020-12-28 13:13:24 +08:00
Fenny 0d2eb334d6 🧪 update test cmd 2020-11-14 03:31:46 +01:00
jonanOribe 4fc45599d2 Update app_test.go 2020-11-10 18:22:02 +01:00
jonanOribe d27b4cfa1e Update app_test.go 2020-11-10 18:10:11 +01:00
kiyon d0e828dbf5 🍀 Improve test coverage 2020-10-24 16:24:48 +08:00
Roman 3e6dfb313b 🔥set a `Cache Control` header for static ressources
Right now, each static request returns the file without any cache control
header. If you are using `app.Static` to serve your assets, the
browser shouldn't cache it. This PR introduces a way to set the cache
control header (if the file was found) on the file response to set a
custom max-age to e.g. cache it 1 year.
2020-10-07 15:44:38 +02:00
Roman acb6bbea2b ♻️ refactor app test to use the constants to access the http methods and headers 2020-10-07 11:07:12 +02:00
David Mazary 618b753230 🚨 Fix gosimple lint warnings 2020-10-03 13:20:54 -04:00
Fenny b4bec8df6c
Merge pull request #877 from kiyonlin/fix-app-group
👷 fix group.Mount
2020-10-03 18:47:56 +02:00
kiyon 839c8f1447 👷 fix group.Mount 2020-10-04 00:36:11 +08:00
kiyon 407cdfaf7a 👷 add app test case to improve coverage 2020-10-04 00:05:28 +08:00
Fenny 3b5997a3df 🔨 fix mount tree build
Co-Authored-By: RW <7063188+ReneWerner87@users.noreply.github.com>
2020-09-26 13:46:14 +02:00
Fenny 2b72fd2162 🩹 ignore trailing slash with static directories 2020-09-20 21:48:45 +02:00
ReneWerner87 c822a17c72 ☠️ Improve error handling flow
Co-authored-by: Fenny <fenny@gofiber.io>
Co-authored-by: Kiyon <kiyon@gofiber.io>
2020-09-18 20:44:00 +02:00
kiyon 27cd8ad9c5 👷 improve app and prefork test cases 2020-09-15 09:02:24 +08:00
Fenny 2768ea2a77 🙌 make utils public
Co-Authored-By: RW <7063188+ReneWerner87@users.noreply.github.com>
2020-09-14 12:12:29 +02:00
Fenny a3cac71ae8 🔦 move utils to internal 2020-09-14 09:09:06 +02:00
Fenny ec5d66e7a8 v2 2020-09-13 11:20:11 +02:00
kiyon 96b571165a 👷 remove read timeout test case temporarily 2020-07-29 15:18:49 +08:00
kiyon 0d4b3c4c27 👷 use different port in every test case 2020-07-29 14:52:13 +08:00
kiyon dd33a79772 👷 improve read timeout test case 2020-07-29 13:08:33 +08:00
kiyon 3779723507 👷 add app.Test test cases 2020-07-29 09:14:15 +08:00
kiyon d15aae1e56 👷 add app.init test cases 2020-07-29 08:46:36 +08:00
kiyon c460cba729 👷 add app.Stack test cases 2020-07-28 16:48:05 +08:00
Fenny f62be7c5ee 🗑️ Remove deprecated tests
Co-Authored-By: RW <renewerner87@googlemail.com>
Co-Authored-By: kiyon <kiyonlin@users.noreply.github.com>
2020-07-22 02:06:56 +02:00
ReneWerner87 b34a77bc96 💉 Sync route method metadata
Co-authored-by: Fenny <fenny@gofiber.io>
2020-07-21 23:30:52 +02:00
kiyon 24a87436ae 🎱 The actual count of routes will be reduced after compression 2020-07-21 08:53:36 +08:00
wernerr 647e08ec00 🚀 compress same route's handler 2020-07-20 19:48:43 +02:00
wernerr b9bdc0d4a8 🚀 compress same route's handler 2020-07-20 19:29:54 +02:00
kiyon 174eb0e33d 🚀 compress same route's handler and sort routes when registering 2020-07-20 21:43:01 +08:00
kiyon 86af9e486c 💯 remain code coverage 2020-07-18 10:42:22 +08:00
kiyon c89bfb3634 🔔 fix ctx matched bug, it should be reset to false when acquired 2020-07-17 09:34:27 +08:00
kiyon 30a704b5f9 👷 improve test coverage 2020-07-16 16:42:36 +08:00
Fenny 0080aff71d 🧪 Add TLS tests 2020-07-15 18:56:42 +02:00
Fenny ca1bd29359 🧪 Add TLS Tests 2020-07-15 18:50:28 +02:00
Fenny da85c85c14 🧪 Increase test coverage: 96% 2020-07-15 17:43:30 +02:00
kiyon a70f37adff 👍 improve app test coverage 2020-07-15 10:20:53 +08:00
kiyon 80e222093d 🍤 improve app test coverage 2020-07-14 15:23:41 +08:00
Fenny b133583f66 🧪 Update go golint 2020-07-13 15:41:22 +02:00
songjiayang 4ef6f9b0e1 Update for golint 2020-07-13 10:47:14 +08:00
Fenny fc5d2d7e66 📦 Update test case
Co-Authored-By: kiyon <kiyonlin@163.com>
2020-07-10 14:16:35 +02:00
Fenny 9e51dd4ead 📦 Update test case 2020-07-10 14:15:58 +02:00
Fenny 3484897184 🐛 Avoid method override on 405 2020-07-10 13:57:53 +02:00