1
0
mirror of https://github.com/gofiber/fiber.git synced 2025-02-06 20:31:35 +00:00

29 Commits

Author SHA1 Message Date
nickajacks1
6b9630b5f7
🚨 Test: improve benchmarks for getOffer (#2739) 2023-11-23 09:36:22 +01:00
nickajacks1
cbcb1aec0a
feat: add support for parameters in content negotiation (#2678)
*  feat: add support for parameters in content negotiation

Attempts to approach the level of support offered by express,
but behavior may differ in unusual corner cases.
Some key behaviors from Express that are implemented:
 - If an offer does not have every parameter listed in the given Accept,
   it is rejected.
 - Parameters do not affect specificity.
 - In a given specificity, more parameters gives greater precedence
 - Parameters are unordered
 - Matching is case-insensitive
 - Surrounding quotes for parameter values are stripped
 - If an Accept type specifies a parameter more than once, the last
   value provided is taken.
 - Parameters after q are not processed.

https://www.rfc-editor.org/rfc/rfc9110#name-parameters

* doc: properly attribute reader.go for validHeaderFieldByte

* fix: remove underscores from fuzz test name

* test(forEachParameter): improve coverage

* doc: add comment clarifying RFC 9110 non-compliance for corner case
2023-11-07 08:25:23 +01:00
João Victor Oliveira Couto
f29f39b1b3
fix: Decompress request body when multi Content-Encoding sent on request headers (#2555)
* 🔧 feat: Decode body in order when sent a list on content-encoding

* 🚀 perf: Change `getSplicedStrList` to have 0 allocations

* 🍵 test: Add tests for the new features

* 🍵 test: Ensure session test will not raise an error unexpectedly

* 🐗 feat: Replace strings.TrimLeft by utils.TrimLeft

Add docs to functions to inform correctly what the change is

* 🌷 refactor: Apply linter rules

* 🍵 test: Add test cases to the new body method change

* 🔧 feat: Remove return problems to be able to reach original body

* 🌷 refactor: Split Body method into two to make it more maintainable

Also, with the previous fix to problems detected by tests, it becomes really hard to make the linter happy, so this change also helps in it

* 🚀 perf: Came back with Header.VisitAll, to improve speed

* 📃 docs: Update Context docs
2023-08-06 17:23:37 +02:00
Jason McNeil
0f5ffed3cc
🐛fix: update getOffer to consider quality and specificity (#2486)
* feat: getOffer consider q value and specificity

* fix: ignore q=0

* fix: float

* test: client-prefered order and q=0 not acceptable

* fix: always use my insertion sort.

* fix: sort.SliceStable if > 20

* fix: zero allocations

* perf: optimize the sort

* chore: fix lint issue

* fix: consider order

* chore: fix test func name

* chore: fix helper test func name

* chore: revert fix

* perf: use fasthttp.ParseUfloat

* test: GetOffer and SortAcceptedTypes

* chore: remote nil check

* test: sortAcceptedTypes

* fix: use utils.UnsafeBytes

* docs: update docs for fiber PR #2486

* docs: update docs for fiber PR #2486

* test: add test from docs

* fix: yaml
2023-06-07 17:51:45 +02:00
RW
28d9abb71b
Fix #2383, accepts mimeType (#2386)
* Fix #2383, accepts mimeType

* Fix #2383, accepts mimeType

* Fix #2383, accepts mimeType
2023-03-27 15:55:41 +02: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
M. Efe Çetin
305bb072be
🧹 tidy up: fix linter errors for tests (#2102) 2022-09-19 08:33:58 +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
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
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
0734c9d3fc
🔍 fix unhandled errors in helpers_test.go (#2058)
* 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
2022-08-29 14:12:12 +02:00
RW
1bbcb4b8f3
Fix for "Why net.Addr is fiber.testAddr, not *net.TCPAddr?🤗 #1574" (#1784) 2022-02-19 02:08:06 +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
Rupesh Harode
9dd39c0e55
🩹 Fix: corrects ipv6 loopback ip shown on UI (#1517)
Author:    Rupesh Harode <rupeshharode@gmail.com>

Co-authored-by: Rupesh Harode <rupesh.harode@dailyrounds.org>
2021-09-03 14:23:03 +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
Kiyon
00dbdd5fb3 👷 Add network type constant 2021-02-08 11:35:17 +08:00
Kiyon
0ec0f50cfd 🔥 Add network option 2021-02-07 13:55:13 +08:00
Kiyon
2d34c78e7e 👷 Add test cases for getGroupPath 2020-12-28 13:16:33 +08:00
Kiyon
bdfad180f7 👷 Auto add '/' prefix for Group 2020-12-24 14:14:49 +08:00
Fenny
1468a049c4 ✏ removeNewLines is present in fh 1.18
Co-Authored-By: RW <7063188+ReneWerner87@users.noreply.github.com>
Co-Authored-By: kiyon <kiyon@gofiber.io>
2020-12-11 00:49:57 +01:00
Fenny
27baab0ea0 🧨 introduce destroy 2020-11-13 18:30:14 +01:00
Fenny
ee596c2c8d 👋 remove unused fn 2020-11-11 18:43:56 +01:00
Fenny
8bd50de610 🧹 housekeeping 2020-11-11 13:54:27 +01:00
David Mazary
71d3e16be4 🚨 Remove unused isIPv6 func 2020-10-03 13:31:33 -04:00
Fenny
d6f717148a 🛠 correct convert naming 2020-09-27 12:22:17 +02:00
kiyon
3f64a4f781 👷 improve helpers test cases 2020-09-15 09:16:27 +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
77843393c4 🏃‍♀️ move utils to internal
Co-Authored-By: RW <7063188+ReneWerner87@users.noreply.github.com>
2020-09-14 09:27:25 +02:00