Commit Graph

64 Commits (v2)

Author SHA1 Message Date
Jmper 2c5d883a69
[Bug]: utils.IsIPv4 and net.ParseIP have inconsistent results #2735 (#2736) 2023-11-21 10:48:37 +01:00
René Werner bb90fc1187 fix lint errors 2023-10-11 15:16:35 +02:00
Tiago Peczenyj d25dfa4ce7
apply go fix ./... with latest version of go in repository (#2661)
apply go fix ./...
2023-10-05 12:24:59 +02:00
leonklingele fe487934f9
utils: add Go 1.20+ way of converting byte slice to string (#2468)
Ref. d2f97fc426/b2s_old.go.
Ref. d2f97fc426/b2s_new.go.
2023-05-19 11:07:20 +02:00
leonklingele eced39c47e
utils: add Go 1.20+ way of converting string to byte slice (#2462)
* utils: add Go 1.20+ way of converting string to byte slice

Ref. d2f97fc426/s2b_old.go.
Ref. d2f97fc426/s2b_new.go.

* utils: fix golangci-lint apparently running with Go < 1.20

See https://github.com/gofiber/fiber/actions/runs/4968641325/jobs/8891360463?pr=2462.
2023-05-15 07:21:16 +02:00
Erkan Durmuş 547db83cdd
Get mime fallback (#2340)
* added fallback to go's mime detection

* added test for getting mime

* added err check

* added err check

* removing import alias for builtin mime and aserting error for adding mime type.

* removing import alias for builtin mime and aserting error for adding mime type.

* added fallback to go's mime detection

* added test for getting mime

* added err check

* added err check

* removing import alias for builtin mime and aserting error for adding mime type.

* removing import alias for builtin mime and aserting error for adding mime type.

---------

Co-authored-by: René Werner <rene.werner@verivox.com>
2023-03-24 14:29:42 +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
Limux e2cb81ddd3
🚨 added testcases and minor algorithm improvment (#2308)
* Deleted redundant check for an ipv4 address octet block that is bigger than 255 in utils/ip.go. Also added a testcase for octetblocks that are bigger than 255.

* Added extra testcases
2023-01-25 20:38:29 +01:00
M. Efe Çetin e5ae764139
🧹 update: replace UnsafeBytes util with suggested way (#2204) 2022-11-13 16:58:42 +01:00
leonklingele 5cac575ad0
utils: reduce diff to external utils package (#2206)
f33fd2c5f7/bytes.go
2022-11-12 08:27:57 +01:00
leonklingele e388e0edb3
Update HTTP status codes (#2203)
* helpers: add HTTP status code 306

* helpers: show numeric HTTP status code instead of status code RFC next to errors

* utils: add HTTP status code 425

* helpers,utils: update list of HTTP status codes
2022-11-11 08:40:37 +01:00
RW ce2d087394
Improve memory storage (#2162)
* improve memory storage code and performance

* improve memory storage code and performance

* improve memory storage code and performance

* improve memory storage code and performance

* improve memory storage code and performance

* improve memory storage code and performance
2022-10-19 16:22:42 +02:00
sadfun 5316f0823d
🚀 Make IP validation 2x faster (#2158)
* 🚀 Make IP vallidation 2x faster

* Add tests for IP validation

* phrasing & linter fix

* change test assert function

That was a surprise that testing style in gofiber/utils and in gofiber/fiber/utils are different 😳
2022-10-18 11:59:23 +02:00
Soham Sen 9a6002056c
Switch to text/javascript as per RFC9239 (#2146)
* Switch to text/javascript as per RFC9239

* Add deprecated flag to application/javascript
2022-10-10 14:29:51 +02:00
leonklingele 902e30efb6
utils: update mime extensions (#2133) 2022-10-05 09:10:20 +02:00
M. Efe Çetin 95abdacba0
feature: add XML to context. (#2003)
*  feature: add XML to context.

* Update app.go
2022-08-16 08:05:35 +02:00
Vano Devium 901492a784
utils: ConvertToBytes: empty string (#1877) 2022-04-24 19:15:59 +02:00
Vano Devium 63391d47b4
utils: ConvertToBytes (#1875)
* utils: ConvertToBytes

* remove unneeded compare with golang function

* remove unneeded compare with golang function

* Update common_test.go

* utils: ConvertToBytes

Speed improvement
old:
Benchmark_ConvertToBytes/fiber-8                 3541161                317.9 ns/op          128 B/op          2 allocs/op
Benchmark_ConvertToBytes/fiber-8                 3465039                336.8 ns/op          128 B/op          2 allocs/op

new:
Benchmark_ConvertToBytes/fiber-12               32883782                33.76 ns/op            0 B/op          0 allocs/op
Benchmark_ConvertToBytes/fiber-12               36084900                33.47 ns/op            0 B/op          0 allocs/op

Co-authored-by: RW <rene@gofiber.io>
2022-04-24 12:06:06 +02:00
M. Efe Çetin ee65ea5bab
🧹 Use encoding/json (#1851)
* remove goccy/go-json

* fix tests.
2022-04-13 10:45:33 +02:00
Serhat Şevki Dinçer 2b5b6b24ee
🐛 utils: fix EqualFold and docs (#1833)
* 🔍 utils: add/improve tests for ToLower/ToUpper/EqualFold

* 🐛 utils: fix EqualFold and docs
2022-03-23 13:55:13 +01:00
Fufu 7b1a7a9513
fix: utils.TrimBytes should trim all content (#1779)
* perf: if all string content should be trimmed, end the loop early

* test: complete test cases for all Trim functions

* fix: utils.TrimBytes should trim all content
2022-02-15 07:57:51 +01:00
Trim21 391ae594d8
fix: `utils.Trim` should trim all string content (#1775)
* fix: `utils.Trim` should trim all string content

* add empty string input

* better fix
2022-02-14 08:01:15 +01:00
Sujit Baniya 505e4d77a7
[FEATURE REQUEST] - Add RedirectToRoute and RedirectBack (#1750)
* 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

Co-authored-by: RW <rene@gofiber.io>
2022-02-09 09:02:45 +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
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
Ali Baran Eser cdbcfbec17
🔥 Feature: add IP ranges support to config.TrustedProxies (#1602)
* feat: add IP ranges support to config.TrustedProxies

* Added config example to README and moved IncrementIPRange to utils.
2021-10-28 00:46:39 +02:00
RW 658b4e42b1
Fix - ParseVendorSpecificContentType fir dart content type (#1594)
Close #1582
2021-10-25 07:13:57 +02:00
M. Efe Çetin 9eaa8b0c73
Change default json lib. (#1563)
* Change default json lib.

* Remove gopsutil test.

* Fix tests.

* Ignore linter for UnmarshalFieldError.

* update
2021-10-11 08:28:06 +02:00
Shirshendu Bhowmick d89207831d
🐛 Fix: ctx.BodyParser was not able to parse vendor specific content type (#1506) 2021-08-22 17:53:14 +02:00
Paul Cento 15987a2677
♻️ Refactor: remove use of deprecated functions (#1474) 2021-08-06 07:56:36 +02:00
Roman ca0e784fb9
Refactor cache middleware to not-use the deprecated methods (#1246)
* ♻️ refactor: cache: don't use the deprecated `SafeBytes` and use `CopyBytes` instead

* ♻️ refactor: utils: remove deprecated and unused methods
2021-03-30 23:31:03 +02:00
RW 12cefa2f31
Prepare release
- bump version
2021-03-13 12:49:51 +01:00
Kiyon c34ca83c06 👷 Add JSONEncoder and JSONDecoder 2021-02-20 16:45:13 +08:00
Joey 267fd5ec59
Merge pull request #1121 from yquansah/yq-override-json
feat: add definition for overridable json engine
2021-01-31 07:56:41 +01:00
unknown c62e5f7d4d go style updates 2021-01-26 21:57:58 +03:00
Yoofi Quansah 5941c8c4e2 🧹 chore: address comments, and use more standard definition for
functionality we define
2021-01-25 13:48:07 -06:00
Yoofi Quansah 2267f0f76f 🚀 feat: add custom definition for a json executor 2021-01-19 20:25:44 -08:00
Fenny ebd507d5e5 🦵 limit go routines in test 2020-11-30 14:34:17 +01:00
Fenny 7be78406cb 🔐 use uuid v4 in session 2020-11-30 14:31:10 +01:00
Fenny 772d78186a 🐌 too slow, need better alternative 2020-11-27 18:34:22 +01:00
Fenny 0c8efc3de3 💱 update uuid 2020-11-27 16:58:19 +01:00
Fenny e1078f8716 🩹 fix #1030 2020-11-26 12:05:43 +01:00
Fenny 0cc60e3e39 ✏ update utils
Co-Authored-By: RW <7063188+ReneWerner87@users.noreply.github.com>
2020-11-17 08:24:28 +01:00
Fenny e44da45bff 🩹 fix session test
Co-Authored-By: RW <7063188+ReneWerner87@users.noreply.github.com>
2020-11-17 08:15:22 +01:00
Fenny cdba739a40 📦 add EqualFold & EqualFoldBytes
Co-Authored-By: RW <7063188+ReneWerner87@users.noreply.github.com>
2020-11-17 08:04:42 +01:00
Szymon Bielenica 56283b8afd 🎨 Adjust multiple comments to comply with the linter 2020-10-25 12:23:10 +01:00
Fenny 0e21234f5e 📦 vendor gopsutil 2020-09-27 22:56:31 +02:00
Fenny d9ca77a834 ✏ fix typo 2020-09-27 12:23:46 +02:00