Commit Graph

56 Commits (bind)

Author SHA1 Message Date
RW fadedcb5be
Use utils Trim functions instead of the strings/bytes functions (#3087)
* Use utils Trim functions instead of the strings/bytes functions

* rename Test and Benchmark functions with same name
2024-07-24 16:25:35 +02:00
Juan Calderon-Perez 8c3f81e2b7
v3: Use Named Fields Instead of Positional and Align Structures to Reduce Memory Usage (#3079)
* Use composites for internal structures. Fix alignment of structures across Fiber

* Update struct alignment in test files

* Enable alignment check with govet

* Fix ctx autoformat unit-test

* Revert app Config struct. Add betteralign to Makefile

* Disable comment on alert since it wont work for forks

* Update benchmark.yml

* Update benchmark.yml

* Remove warning from using positional fields

* Update router.go
2024-07-23 08:37:45 +02:00
dockercui 3a0313de85
Fix some comments (#2983)
Signed-off-by: dockercui <dockercui@aliyun.com>
2024-04-24 11:12:06 +02:00
deferdeter 2f8ff5662d
chore: fix some struct names in comments (#2974)
Signed-off-by: deferdeter <deferdeter@outlook.com>
2024-04-16 08:15:13 +02:00
leonklingele 5449b04101
feat: make golangci-lint config stricter (#2874) 2024-03-17 13:46:20 +01:00
M. Efe Çetin 2a2801f486
v3 (feature): add support for custom constraints (#2807)
*  v3 (feature): add support for custom constraints

* fix linter

* fix

* disable goconst linter for tests

* update docs

* update
2024-02-02 09:56:58 +01:00
Muhammed Efe Cetin 75bb02b87e
Merge remote-tracking branch 'origin/master' into v3-beta 2023-08-05 22:02:01 +03:00
Moein Halvaei 5967d36bc0
✏️ Fix typo (#2518)
* Fix: typo in client.go

* Fix: typo in ctx.go

* Fix: typo in path.go

* Fix: typo in router.go

* Fix: typo in adaptor.go
2023-06-23 16:15:38 +02:00
Muhammed Efe Çetin 3168a60605
👷 v3 (ci): fix some linter warnings 2023-02-09 23:15:21 +03:00
Muhammed Efe Çetin 088cde594d
Merge remote-tracking branch 'origin/master' into v3-beta 2023-02-05 23:43:42 +03:00
René Werner 028d821bea prepare release 2023-02-03 13:59:47 +01:00
M. Efe Çetin 2820aef585
🧹 chore: add go 1.20 to ci and readmes (#2322)
*  chore: add go 1.20 to ci and readmes

* 🧹 chore: add go 1.20 to ci and readmes

* update linter

* fix linter

* fix benchmarks

* fix benchmarks

* fix benchmarks
2023-02-02 23:01:37 +03:00
leonklingele ac4ce21d9c
🐛 Bug: Fix issues introduced in linting PR (#2319)
* internal: revert linting changes

Changes to the internal package should not have been made in 167a8b5e94.

* middleware/monitor: revert changes to exported field "ChartJSURL"

This is a breaking change introduced in 167a8b5e94.

* middleware/monitor: fix error checking

Fix the errorenous error checking introduced in 167a8b5e94.

* 🐛 Bug: Fix issues introduced in linting PR #2319

* 🐛 Bug: Fix issues introduced in linting PR #2319

* Bug: Fix issues introduced in linting PR #2319

---------

Co-authored-by: René Werner <rene@gofiber.io>
2023-02-02 15:57:40 +01: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
pj f13c948e36
Match function (#2142)
Add matching function

Co-authored-by: rocketlaunchr-cto <rocketlaunchr.cloud@gmail.com>
2022-12-11 17:37:35 +01:00
M. Efe Çetin 077a5dc3d4
🐛 bug: fix regex constraints that contain comma (#2256) 2022-12-05 08:27:31 +01:00
Muhammed Efe Çetin c62dd16e8d
Merge remote-tracking branch 'origin/master' into v3-beta 2022-11-27 20:34:48 +03:00
James R T c63a569a92
🚀 [Feature]: Allow optional params with route constraints (#2179)
Signed-off-by: James R T <jamestiotio@gmail.com>

Signed-off-by: James R T <jamestiotio@gmail.com>
2022-11-01 08:49:44 +01:00
Muhammed Efe Çetin 9428befb9c
Merge remote-tracking branch 'origin/master' into v3-beta 2022-10-28 17:26:17 +03:00
M. Efe Çetin 35753f7eac
🐛 bug: fix constraints when to use multiple params (#2077)
* 🐛 bug: fix constraints when to use multiple params

* test case route matching
remove the parameters for negative routing matches, as they are unnecessary and should not be considered there

Co-authored-by: René Werner <rene@gofiber.io>
2022-09-08 07:29:05 +02:00
Muhammed Efe Çetin 319b8ea3a8
Merge remote-tracking branch 'origin/master' into v3-beta 2022-09-03 23:56:45 +03:00
Amir Hossein b7500a8d08
unhandled error in hooks test (#2070)
* 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
2022-09-02 08:01:55 +02:00
M. Efe Çetin e72ea32dd2
🐛 bug: fix regex constraints (#2059) 2022-08-30 08:40:58 +02:00
M. Efe Çetin aef7ea53b3
🐛 bug: fix route constraints problems (#2033)
* 🐛 bug: fix route constraints problems

* escape support for data

* exactLen -> len
2022-08-26 14:16:06 +02:00
Trim21 b161f805c2
v3(enhancement): remove `utils.Trim*` (#2030)
stdlib functions have same performance in go1.19
2022-08-20 13:52:09 +08:00
Muhammed Efe Çetin 4105b008c2
Merge remote-tracking branch 'origin/master' into v3-beta 2022-08-19 14:33:31 +03:00
M. Efe Çetin 2517944c80
feature: route constraints (#1998)
* Segment parameters constraints and determining it's type

* add parsing for constraints.

* fix tests

* add tests, benchs & some fixes.

* fix regex & datetime tests.

* clean up constraint parser, multiple constraint support.

* update

* regex customization.

* constants, remove variadic methods.

* add some benchs, refactor constraint check funtion.

* more readable conditions

* fix tests

* precompile regex

* precompile regex when parsing the route

* update comments
Co-authored-by: wernerr <rene@gofiber.io>

Co-authored-by: Mohab Abd El-Dayem <mohab.m.mohamed@gmail.com>
Co-authored-by: RW <rene@gofiber.io>
2022-08-16 08:05:50 +02:00
RW ff1e0109a3
Closes #1931 "🤗 How to get path param before a custom verb?" (#1983)
* Add possibility for parameters before custom verb
FIX for "🤗 How to get path param before a custom verb? #1931"

* try to stabilize the tests
2022-07-27 08:37:03 +02:00
Muhammed Efe Çetin 1188144d78
🎉 v3: init 2022-05-31 17:35:49 +03:00
Sujit Baniya 3bb4b7ed41
Fix GetLocationFromRoute bug for optional params (#1922)
* 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

* Add RedirectToRoute and RedirectBack with fallback if referer in header not found

* replace errors.New with fmt.Errorf

* simplified code

* Add tests for different formats

* Add method to get route location and add benchmarks

* Add ToString function

* Fix error

* rearrange case for fmt.Stringer

* Fix bug for error return

* Lock latest route for app.Name(namee string)

* decreasing timeout for client test with timeout

* remove println and adjust condition to > 0

* Change name to get route url

* Change name to get route url

* Update ctx.go

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

* Fix bug on getting url for optional and greedy params

* Fix greedy pattern

* This PR will fix #1921 (comment).

The optional and greedy params were not fetched correctly

* This PR will fix #1921 (comment).

The optional and greedy params were not fetched correctly

* This PR will fix #1921 (comment).

The optional and greedy params were not fetched correctly

Co-authored-by: RW <rene@gofiber.io>
Co-authored-by: hi019 <65871571+hi019@users.noreply.github.com>
2022-05-31 13:58:13 +02: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
RW 87b0a15f1e
Fix - prevent panic on GetTrimmedParam (#1593)
Close #1587
2021-10-25 07:25:31 +02:00
Javad Rajabzade 7609117cec
Improved some conditions (#1386)
* simplify `u <= (1<<7)-1` to `u < (1 << 7)`

* It's not recommended to use `len` for empty string, we can check with string with ""

* It's not recommended to use `len` for empty string, we can check with string with ""

* It's not recommended to use `len` for empty string, we can check with string with ""

* It's not recommended to use `len` for empty string, we can check with string with ""

* Instead Bool comparison can using simplified bool check if !var = false checking

* Unnecessary use of fmt.Sprintf for value without format

* For check condition two value not required ! method

* nil check may not be enough for slice, better check with len

* function parameters combined

* When the form returns error information, the text content should not start with a capital letter or end with a punctuation mark

* error var invalidPath should have name of the form errFoo, It is recommended that the error variables that are part of an API should be named

* change to condition len(x), it's faster https://github.com/gofiber/fiber/pull/1386#discussion_r652369520

* Update write.go

* Update write_bytes.go

* Update store.go

Co-authored-by: RW <rene@gofiber.io>
2021-06-17 22:03:59 +02:00
RW 033184938c
🚀 new possibility to escape special routing parameters (#1280)
* 🚀 new possibility to escape special routing parameters, which gives the possibility to follow the google api design guide https://cloud.google.com/apis/design/custom_methods

* 🚀 new possibility to escape special routing parameters, which gives the possibility to follow the google api design guide https://cloud.google.com/apis/design/custom_methods
2021-04-12 21:45:24 +02:00
ReneWerner87 b51def0bb8 🐛 UnescapePath not working #1102
Co-authored-by: Fenny <fenny@gofiber.io>
2021-01-06 13:21:54 +01:00
ReneWerner87 9b69bdadc8 🐛 Fix wrong route matching for not greedy parameter
#1016

Co-authored-by: Fenny <fenny@gofiber.io>
2020-11-13 16:17:48 +01:00
Fenny 9fd68c62b0 ✏ update comments 2020-09-29 21:49:50 +02:00
Fenny b96cbff310
Merge pull request #774 from Fenny/master
👂 uncomment internal benchmarks
2020-09-14 12:15:24 +02:00
Fenny 2768ea2a77 🙌 make utils public
Co-Authored-By: RW <7063188+ReneWerner87@users.noreply.github.com>
2020-09-14 12:12:29 +02:00
ReneWerner87 a828c5d0e8 🪓 Code separation for utils (🧹clean code)
Co-authored-by: Fenny <fenny@gofiber.io>
Co-authored-by: Kiyon <kiyon@gofiber.io>
2020-09-14 10:30:35 +02:00
ReneWerner87 712b585b9d 🪓 Code separation for utils (🧹clean code)
Co-authored-by: Fenny <fenny@gofiber.io>
Co-authored-by: Kiyon <kiyon@gofiber.io>
2020-09-14 10:23:22 +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
ReneWerner87 053d463fa6 🚀 improve routing behavior 2020-08-10 10:14:17 +02:00
ReneWerner87 67caca823b 🚀 improve routing behavior 2020-08-10 09:50:53 +02:00
ReneWerner87 cff454dfc2 🚀 improve routing behavior 2020-08-09 22:05:14 +02:00
ReneWerner87 d9c09fa68e 🚀 improve routing behavior 2020-08-09 19:50:10 +02:00
ReneWerner87 b8ca4c9b8a 🚀 improve routing behavior 2020-08-07 21:42:53 +02:00
ReneWerner87 2283fd2756 🚀 improve routing behavior 2020-08-07 14:38:40 +02:00
ReneWerner87 582b10a6d4 🚀 improve routing behavior 2020-08-06 02:43:58 +02:00