Commit Graph

333 Commits (4b62d3d592248077c38f53d6117828f278e8eb3f)

Author SHA1 Message Date
RW ec48a76f14
V2 to v3 merge (#2864)
* Update pull_request_template.md

* Update v3-changes.md

* Update CONTRIBUTING.md (#2752)

Grammar correction.

* chore(encryptcookie)!: update default config (#2753)

* chore(encryptcookie)!: update default config

docs(encryptcookie): enhance documentation and examples

BREAKING CHANGE: removed the hardcoded "csrf_" from the Except.

* docs(encryptcookie): reads or modifies cookies

* chore(encryptcookie): csrf config example

* docs(encryptcookie): md table spacing

* build(deps): bump actions/setup-go from 4 to 5 (#2754)

Bumps [actions/setup-go](https://github.com/actions/setup-go) from 4 to 5.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* 🩹 middleware/logger/: log client IP address by default (#2755)

* middleware/logger: Log client IP address by default.

* Update doc.

* fix: don't constrain middlewares' context-keys to strings 🐛 (#2751)

* Revert "Revert "🐛 requestid.Config.ContextKey is interface{} (#2369)" (#2742)"

This reverts commit 28be17f929.

* fix: request ContextKey default value condition

Should check for `nil` since it is `any`.

* fix: don't constrain middlewares' context-keys to strings

`context` recommends using "unexported type" as context keys to avoid
collisions https://pkg.go.dev/github.com/gofiber/fiber/v2#Ctx.Locals.

The official go blog also recommends this https://go.dev/blog/context.

`fiber.Ctx.Locals(key any, value any)` correctly allows consumers to
use unexported types or e.g. strings.

But some fiber middlewares constrain their context-keys to `string` in
their "default config structs", making it impossible to use unexported
types.

This PR removes the `string` _constraint_ from all middlewares, allowing
to now use unexported types as per the official guidelines. However
the default value is still a string, so it's not a breaking change, and
anyone still using strings as context keys is not affected.

* 📚 Update app.md for indentation (#2761)

Update app.md for indentation

* build(deps): bump github.com/google/uuid from 1.4.0 to 1.5.0 (#2762)

Bumps [github.com/google/uuid](https://github.com/google/uuid) from 1.4.0 to 1.5.0.
- [Release notes](https://github.com/google/uuid/releases)
- [Changelog](https://github.com/google/uuid/blob/master/CHANGELOG.md)
- [Commits](https://github.com/google/uuid/compare/v1.4.0...v1.5.0)

---
updated-dependencies:
- dependency-name: github.com/google/uuid
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump github/codeql-action from 2 to 3 (#2763)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2 to 3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Changing default log output (#2730)

changing default log output

Closes #2729

* Update hooks.md

fix wrong hooks signature

* 🩹 Fix: CORS middleware should use the defined AllowedOriginsFunc config when AllowedOrigins is empty (#2771)

* 🐛 [Bug]: Adaptator + otelfiber issue #2641 (#2772)

* 🩹🚨 - fix for redirect with query params (#2748)

* redirect with query params did not work, fix it and add test for it

* redirect middleware - fix test typo

* ♻️ logger/middleware colorize logger error message #2593 (#2773)

*  feat: add liveness and readiness checks (#2509)

*  feat: add liveness and readiness checkers

* 📝 docs: add docs for liveness and readiness

*  feat: add options method for probe checkers

*  tests: add tests for liveness and readiness

* ♻️ refactor: change default endpoint values

* ♻️ refactor: change default value for liveness endpoint

* 📝 docs: add return status for liveness and readiness probes

* ♻️ refactor: change probechecker to middleware

* 📝 docs: move docs to middleware session

* ♻️ refactor: apply gofumpt formatting

* ♻️ refactor: remove unused parameter

* split config and apply a review

* apply reviews and add testcases

* add benchmark

* cleanup

* rename middleware

* fix linter

* Update docs and config values

* Revert change to IsReady

* Updates based on code review

* Update docs to match other middlewares

---------

Co-authored-by: Muhammed Efe Cetin <efectn@protonmail.com>
Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
Co-authored-by: Juan Calderon-Perez <jgcalderonperez@protonmail.com>

* prepare release v2.52.0
- add more Parser tests

* fix healthcheck.md

* configure workflows for V2 branch

* configure workflows for V2 branch

* Fix default value to false in docs of QueryBool (#2811)

fix default value to false in docs of QueryBool

* update queryParser config

* Update ctx.md

* Update routing.md

* merge v2 in v3

* merge v2 in v3

* lint fixes

* 📚 Doc: Fix code snippet indentation in /docs/api/middleware/keyauth.md

Removes an an extra level of indentation in line 51 of
`keyauth.md` [here](https://github.com/gofiber/fiber/blob/v2/docs/api/middleware/keyauth.md?plain=1#L51)

* fix: healthcheck middleware not working with route group (#2863)

* fix: healthcheck middleware not working with route group

* perf: change verification method to improve perf

* Update healthcheck_test.go

* test: add not matching route test for strict routing

* add more test cases

* correct tests

* correct test helpers

* correct tests

* correct tests

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
Co-authored-by: René Werner <rene@gofiber.io>

* merge v2 in v3

* Merge pull request from GHSA-fmg4-x8pw-hjhg

* Enforce Wildcard Origins with AllowCredentials check

* Expand unit-tests, fix issues with subdomains logic, update docs

* Update cors.md

* Added test using localhost, ipv4, and ipv6 address

* improve documentation markdown

---------

Co-authored-by: René Werner <rene@gofiber.io>

* Update app.go

prepare release v2.52.1

* fix cors domain normalize

* fix sync-docs workflow

* test: fix failing tests

* fix sync-docs workflow

* test: cors middleware use testify require

* chore: fix lint warnings

* chore: revert test isolation.

* fixed the fasthttp ctx race condition problem

* Update middleware/cors/utils.go

Co-authored-by: Renan Bastos <renanbastos.tec@gmail.com>

* fix sync_docs.sh

* fix review comments/hints

* fix review comments/hints

* stabilize Test_Proxy_Timeout_Slow_Server test

* stabilize Test_Proxy_.* tests

* ignore bodyclose linter for tests
use http.NoBody instead of nil

* revert(tests): undo http.NoBody usage

* fix(ctx pool): postpone the reset for some values

shortly before the release in the pool

* refactor(tests): use testify panic method instead of custom solution

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: tokelo-12 <113810058+tokelo-12@users.noreply.github.com>
Co-authored-by: Jason McNeil <sixcolors@mac.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: iRedMail <2048991+iredmail@users.noreply.github.com>
Co-authored-by: Benjamin Grosse <ste3ls@gmail.com>
Co-authored-by: Mehmet Firat KOMURCU <mehmetfiratkomurcu@hotmail.com>
Co-authored-by: Bruno <bdm2943@icloud.com>
Co-authored-by: Muhammad Kholid B <muhammadkholidb@gmail.com>
Co-authored-by: gilwo <gilwo@users.noreply.github.com>
Co-authored-by: Lucas Lemos <lucashenriqueblemos@gmail.com>
Co-authored-by: Muhammed Efe Cetin <efectn@protonmail.com>
Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
Co-authored-by: Juan Calderon-Perez <jgcalderonperez@protonmail.com>
Co-authored-by: Jongmin Kim <kjongmin26@gmail.com>
Co-authored-by: Giovanni Rivera <rivera.giovanni271@gmail.com>
Co-authored-by: Renan Bastos <renanbastos.tec@gmail.com>
2024-02-29 08:29:59 +01:00
Giovanni Rivera 3f43c69523
📚 Doc: Fix code snippet indentation in /docs/api/middleware/keyauth.md
Removes an an extra level of indentation in line 51 of
`keyauth.md` [here](https://github.com/gofiber/fiber/blob/main/docs/api/middleware/keyauth.md?plain=1#L51)
2024-02-18 18:34:55 -08:00
nickajacks1 18f0f8780e
v3: Update Version Numbers in Docs (#2853)
* 📚 Docs: Update version numbers for v3

* 📚 Docs: Update template docs to reflect changes in #2848

---------

Co-authored-by: Juan Calderon-Perez <835733+gaby@users.noreply.github.com>
2024-02-12 02:33:32 +03:00
RW 389e63d2c2
Update csrf.md
fix readme example
2024-02-10 19:51:20 +01:00
nickajacks1 97da409533
🎨 Style!: Update CSRF and Limiter to remove repetitive names (#2846)
chore!: Update CSRF and Limiter to remove repetitive names

The `exported` rule of revive warns to not repeat the package name in
method names. For example, prefer `csrf.FromCookie` over
`csrf.CsrfFromCookie`.

This is a breaking change for v3.

It appears that these issues will not be caught by the linter until the
`exported` rule is reenabled. This requires comments on all exported
symbols, which is a much broader effort.
2024-02-10 19:50:29 +01:00
nickajacks1 70067a1754
♻️ Refactor: Remove mutex lock in logger middleware (#2840)
While not all implementations of io.Write will be goroutine safe, the
vast majority of users of the logger middleware are likely to use
os.File, which does implement safe concurrent writes. If users require
locking, they can implement this on an as-needed basis. The risk of
having global locking is that a slow write can hold up the entire
server.
2024-02-10 03:32:37 +03:00
Lino Gomez 847a4a959d
Fix: Typo in routing.md (#2836)
fix routing.md typo
2024-02-08 07:58:12 +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
Muh Ihsan Nur 455405c0f2
Update Typo documentation (#2820) 2024-01-30 09:52:14 +01:00
ACHMAD IRIANTO EKA PUTRA 738e062d5b
Addition of Locals Function with Go Generics as an Alternative to c.Locals (#2813)
* Add type-specific local value handling with generics in Ctx

Introduced a new function, Locals, that utilizes Go's generics to handle and retrieve type-specific local values within a request context. This enhancement provides more accurate data type control within the context. Included are tests for generic and custom struct use-cases to ensure the function performs as expected.

* Update documentation for Go generics in Locals method

Added documentation to explain the new version of the Locals method that uses Go's generics feature. This version allows for better control of data types when manipulating and retrieving local values within a request's context. Examples are provided, along with a caution on using correct data types to prevent a runtime panic.

* update ctx.md

* Correct indentation in API documentation

* Refactor Locals function and add new test case

* Refactor Locals function and add new test case

---------

Co-authored-by: Deza Farras Tsany <deza.ftsany@gmail.com>
2024-01-29 11:26:31 +01:00
ACHMAD IRIANTO EKA PUTRA 9a56a1bf6d
v3: Add QueryParser for get query using generic (#2776)
* Add QueryParser method and tests

Introduced a new method, QueryParser, to parse query parameters from a given context into specified types: integer, boolean, float, and string. The method provides default values for empty or invalid keys. Corresponding tests for each type have also been added to validate the functionality.

* Refactor QueryParser and add string support

Refactored the existing QueryParser method in the code to simplify its structure. Instead of reflecting on types, it now uses explicit type checking. In addition to the existing support for integers, booleans, and floats, the QueryParser method now also supports string parsing. Corresponding tests for the updated method and new feature were added as well.

* Update example call in method comment

Updated the method call example in the comment for the Query function in the ctx.go file. Previously, it was incorrectly demonstrating a call to "QueryParser("wanna_cake", 1)", but this has been updated to correctly represent the method it is commenting, resulting in "Query("wanna_cake", 1)".

* Refactor Query function in ctx.go

The update introduces better type assertion handling in the Query function. A switch statement is now employed to determine the type of the value as opposed to the previous if clauses. In addition, a validation step has been added to ensure the context passed into the function is of the correct type.

* Refactor type handling in Query function

The Query function in ctx.go has been refactored for better and clearer type handling. The code now uses a 'QueryType' interface, replacing explicit string, bool, float, and int declarations. This change also improves the error message when a type assertion fails, making it more descriptive about the specific failure.

* Add type assertion check in ctx.go

Updated the code in ctx.go to add a type assertion check for all case statements. The function now checks if the returned value is of the expected type, and if not, it throws a panic with a description of the failed type assertion.

* Refactor Query function to support more data types

The Query function has been expanded to support a broader range of data types. This includes support for extracting query parameters as different types of integers (both signed and unsigned), strings, floats, and booleans from the request's URI. The function now includes comprehensive parsing capabilities that allow for improved handling of different data types.

* Refactor Query function documentation

The documentation for the Query function has been updated to emphasize its versatility in handling various data types. The changes also clarify how the function operates and demonstrates the usage and benefits of providing a defaultValue. The different variations of QueryBool, QueryFloat, and QueryInt were removed, as they are now encompassed by the enhanced Query function.

* Add benchmark tests for Query function

Benchmark tests have been added to evaluate the performance of the Query function for different data types. These tests will help in assessing the efficiency of the function when processing various queries. The addition of these benchmarks will aid in future optimizations and enhancements of the function.

* Update generic Query function signature

The signature of the generic Query function has been updated to accept different types of data as arguments. The change improves flexibility of the function by allowing it to handle different data types, effectively making it a versatile tool in processing various queries.

* Modify `ctx.Query()` calls in documentation

`ctx.Query()` calls in the ctx.md documentation file were updated to remove the `ctx.` prefix. This is consistent with the typical use cases and makes the code examples more clear and easy to understand.

* Refactored assertValueType function and improved query parameter documentation

Updated the assertValueType function to utilize the utils.UnsafeBytes method for byte conversion. Enhanced the documentation for query parameter types to offer clearer, more comprehensive explanations and examples, including QueryTypeInteger, QueryTypeFloat, and subcategories.

* Update Query method calls to use new fiber.Query syntax

In this commit, the conventional `c.Query()` calls across multiple middleware and document files are updated to use the new `fiber.Query` syntax. The changes align with the updated function signatures in Fiber library that provides type-specific querying. These enhancements contribute to the project's overall robustness and consistency.

* Add Query method to get query string parameters

* Replace 'utils.UnsafeBytes' with 'ctx.app.getBytes'

In the query method, the utils.UnsafeBytes function was replaced with the ctx.app.getBytes method. This change enhances the extraction of query string parameters by making it safer and more context-specific.

* Refactor parsing functions in query handlers

The parsing functions in query handlers have been refactored to simplify the process. Parsing code has been extracted into dedicated functions like 'parseIntWithDefault' and 'parseFloatWithDefault', and they now reside in a new utils file. This modularization improves readability and maintainability of the code. Additionally, documentation is updated to reflect the changes.

* Refactor parsing functions in ctx.go

The parsing functions have been restructured to enhance readability and reduce repetition in the ctx.go file. This was achieved by creating generalised parsing functions that handle defaults and ensure the correct value type is returned. As a result, various single-use parsing functions in the utils.go file have been removed.

* Refactor code to centralize parsing functions
2024-01-19 14:43:44 +01:00
Skillers3 c5cd468671
docs: fix typo in documentation (#2802)
Typo fix
2024-01-18 15:49:16 +03:00
nickajacks1 59410278f1
chore: change interface{} to any (#2796) 2024-01-14 23:04:54 +03:00
Muhammed Efe Cetin 1588b6b602
Merge remote-tracking branch 'origin/master' 2024-01-13 18:26:07 +03:00
Diego Parisi 2143492223
📚 Doc: Undocumented function in session.md (#2795)
SetExpiry was not listed in the Session functions.
2024-01-12 10:31:27 +01:00
René Werner 96344abbd8 change golang pkg for docs 2024-01-08 16:42:07 +01:00
René Werner 9178bf753e configure workflows for main (v3-beta) branch 2024-01-08 16:39:59 +01:00
nickajacks1 956b66d95f
📚 Doc: Update handler signature for v3 (#2794)
📚 Doc: fix handler signature for v3
2024-01-08 16:31:15 +01:00
nickajacks1 408fa20a91
🔥 v3: update Ctx.Format to match Express's res.format (#2766)
* 🔥 v3: update Ctx.Format to match Express's res.format

While the existing Ctx.Format provides a concise convenience method for
basic content negotiation on simple structures, res.format allows
developers to set their own custom handlers for each content type.

The existing Ctx.Format is renamed to Ctx.AutoFormat.

* doc: add docs for Ctx.Format

* refactor: update based on code review feedback

- Rename Fmt to ResFmt
- Add comments in several places
- Return errors instead of panicking in Format
- Add 'Accept' to the Vary header in Format to match res.format

* chore: improve docs and tests for AutoFormat and Format
2024-01-04 09:50:36 +01:00
Jason McNeil 2954e3bbae
♻️ v3: fix!: ContextKey collisions (#2781)
* fix: ContextKey collisions

* fix(logger): lint error

* docs(csrf): fix potential range error in example
2024-01-04 09:44:45 +01:00
RW 28be17f929
Revert "🐛 requestid.Config.ContextKey is interface{} (#2369)" (#2742)
This reverts commit d7b36cde
2023-11-27 14:35:49 +01:00
Jason McNeil 2374cad3cd
📄 docs: improve csrf docs (#2726)
* docs: improve csrf docs

- fix issues with `X-Csrf-Token` capitalization inconsistency.
- reduce redundancy and repetition.
- improve grammar.

* docs: update middleware description

* docs: within vs in

* docs: deleting tokens

* docs: MUST

* docs: add colon

* docs: all modern browsers

* docs: patterns

* docs: improve phrasing of pattern options
2023-11-16 12:34:31 +01:00
René Werner 3ab3d151c7 refresh docs for
🔥 Add support for application/problem+json #2704
2023-11-15 09:23:08 +01:00
Reid Hurlburt 9f082af045
🔥 Add support for application/problem+json (#2704)
🔥 Add support for custom JSON content headers
2023-11-13 15:18:05 +01:00
Muhammed Efe Cetin 6ea4d81331
Merge branch 'master' into v3-beta 2023-11-07 20:22:31 +03: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
Moritz fe395b9850
📚 Doc: Add additional information as to why GetReqHeaders returns a map where the values are slices of strings (#2698)
* Update ctx.md

Added additional information to why GetReqHeaders returns a map where the values are slices of strings (instead of a single string as one might expect)

* Update ctx.md

added the same explanation to GetRespHeaders too
2023-11-01 21:42:57 +01:00
RW 4099ef87bb
Update routing.md
fix invalid regex constraint
2023-11-01 08:22:10 +01:00
Jason McNeil 4bf3695125
📄 docs: enhance csrf.md (#2692)
* docs: enhance csrf.md

* docs: simplify language

* docs: update csrf.md

* docs: delete token/session reminders

* docs: and ! or
2023-10-27 13:45:30 +02:00
René Werner 9347a86cdb 📗 Add example for response handling with fiber client 2023-10-24 08:35:50 +02:00
RW 6f0d34d39e
Update csrf.md 2023-10-16 14:31:28 +02:00
Jason McNeil 8c3916dbf4
Merge pull request from GHSA-94w9-97p3-p368
* feat: improved csrf with session support

* fix: double submit cookie

* feat: add warning cookie extractor without session

* feat: add warning CsrfFromCookie SameSite

* fix: use byes.Equal instead

* fix: Overriden CookieName KeyLookup cookie:<name>

* feat: Create helpers.go

* feat: use compareTokens (constant time compare)

* feat: validate cookie to prevent token injection

* refactor: clean up csrf.go

* docs: update comment about Double Submit Cookie

* docs: update docs for CSRF changes

* feat: add DeleteToken

* refactor: no else

* test: add more tests

* refactor: re-order tests

* docs: update safe methods RCF add note

* test: add CSRF_Cookie_Injection_Exploit

* feat: add SingleUseToken config

* test: check for new token

* docs: use warning

* fix: always register type Token

* feat: use UUIDv4

* test: swap in UUIDv4 here too

* fix: raw token injection

* fix: merege error

* feat: Sentinel errors

* chore: rename test

* fix: url parse

* test: add path to referer

* test: add expiration tests

* docs: add cookie prefix note

* docs: fix typo

* docs: add warning for refer checks

* test: add referer edge cases

And call ctx.Request.Reset() and
ctx.Response.Reset() before re-using ctx.
2023-10-16 09:06:30 +02:00
Javier Scappini d974cf3c99
Fix typo in requestid.md
Minor typo fix in requestid.md.
2023-10-13 11:37:06 +00:00
joey1123455 e70b2e28d6
Cookie parser (#2656)
* prep for branching

* feature: added a cookie parser and tests appropriate tests

*  feature: added a cookie parser and appropriate tests

* made correction to docs

* linted using gofumpt

* ctx_test linted, cookieParser schema added

* fix lint errors (Cookie parser #2656)

* removed extra lines, tested return values

---------

Co-authored-by: René Werner <rene.werner@verivox.com>
2023-10-12 10:44:15 +02:00
Jason McNeil b50d91d58e
Merge pull request from GHSA-94w9-97p3-p368
* feat: improved csrf with session support

* fix: double submit cookie

* feat: add warning cookie extractor without session

* feat: add warning CsrfFromCookie SameSite

* fix: use byes.Equal instead

* fix: Overriden CookieName KeyLookup cookie:<name>

* feat: Create helpers.go

* feat: use compareTokens (constant time compare)

* feat: validate cookie to prevent token injection

* refactor: clean up csrf.go

* docs: update comment about Double Submit Cookie

* docs: update docs for CSRF changes

* feat: add DeleteToken

* refactor: no else

* test: add more tests

* refactor: re-order tests

* docs: update safe methods RCF add note

* test: add CSRF_Cookie_Injection_Exploit

* feat: add SingleUseToken config

* test: check for new token

* docs: use warning

* fix: always register type Token

* feat: use UUIDv4

* test: swap in UUIDv4 here too
2023-10-11 14:41:42 +02:00
RW ada2d4affd
Update hooks.md 2023-10-09 08:58:49 +02:00
René Werner 59409f3841 improve sendFile documentation 2023-10-06 11:43:10 +02:00
René Werner 5171f6b505 improve compress middleware documentation 2023-10-05 09:00:11 +02:00
KaptinLin d00f0b8348
feat: add Reset method to Session struct in session middleware (#2654) 2023-10-02 15:19:35 +02:00
KaptinLin d86c257c89
feat: add Delete method to Store struct in session middleware (#2655)
*  feat: add Delete method to Store struct in session middleware

* ♻ refactor: enhance Delete method and test cases in session middleware
2023-10-02 15:19:18 +02:00
M. Efe Çetin a9447a5b49
ctx: change signatures of GetReqHeaders and GetRespHeaders (#2650)
* ctx: change signatures of GetReqHeaders and GetRespHeaders

* fix middlewares
2023-09-28 08:31:31 +02:00
Jimmy Li c0988de91e
📝 middleware: cors: update docs to better explain AllowOriginsFunc (#2652) 2023-09-28 08:28:35 +02:00
M. Efe Çetin e6d6fbe5a8
middleware: cors: allow disabling caching in preflight requests (#2649) 2023-09-27 15:06:24 +02:00
RW e547bea49e
Update cache.md 2023-09-20 09:14:58 +02:00
)`(-@_.+_^*__*^ 328411a06b
Replaced double quotes with backticks in all route parameter strings (#2591)
* 11-aryan

* Removed the backticks where no special characters is used

* added backticks to path parameters where special characters are escaped

* Replaced double quotes with backticks in all route parameter strings #2591

* Replaced double quotes with backticks in all route parameter strings #2591

---------

Co-authored-by: René Werner <rene@gofiber.io>
2023-09-04 05:40:44 +02:00
René Werner 5745dfe1ac add docs for dynamic routing 2023-08-27 14:29:17 +02:00
René Werner 57aef091c4 add docs for dynamic routing 2023-08-27 14:27:40 +02:00
Jian Lim 35797e6639
📝 Docs: update io/ioutil package to io package (#2589)
Deprecation of io/ioutil
2023-08-22 08:57:00 +02:00
M. Efe Çetin 1dea615ddf
🔥 add config to enable splitting by comma in parsers (#2560)
* 🔥 add config to enable splitting by comma in parsers

🔥 add config to enable splitting by comma in parsers

* optimize if statements, remove escape char support

optimize if statements, remove escape char support

* update
2023-08-21 09:44:02 +02:00
Jacob 892b23bd46
Add custom data property to favicon middleware config (#2579)
* Add custom data property to favicon middleware

* Update favicon middleware docs

* Fix formatting
2023-08-17 15:04:53 +02:00
0bl a50df4fcdd
🩹 Fix: rename WithTlsConfig method to WithTLSConfig (#2570)
* 🩹 Fix: rename WithTlsConfig method to WithTLSConfig

* 🎨 Style: remove stylecheck and revive lint
2023-08-11 07:57:49 +02: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
Muhammed Efe Cetin 75bb02b87e
Merge remote-tracking branch 'origin/master' into v3-beta 2023-08-05 22:02:01 +03:00
M. Efe Çetin e91b02b345
📝 docs: fix wrong JSON docs (#2554) 2023-07-26 13:27:45 +02:00
Renan Bastos 3e5743bcac
doc: Improve *fiber.Client section (#2553)
* wip

* doc: Improve *fiber.Client section

Enhanced the documentation for the *fiber.Client section, providing
a clear and concise example to help users better understand its usage.

* chore: refactor message about example
2023-07-25 20:15:23 +02:00
René Werner 443804e95d improved the config section of the middleware readme´s 2023-07-24 17:03:11 +02:00
RW 51ea636b60
improved the config section of the middleware readme´s (#2552) 2023-07-24 16:46:50 +02:00
Lev Saminskij 5d74725a69
📝 added documentation about ctx Fresh (#2549)
added documentation about ctx Fresh
2023-07-24 15:36:18 +02:00
Precious Luke 2c8c4a6545
Update intro.md (#2550)
Since we are using port 3000, it ideal to maintain that throughout in order not to confuse beginners
2023-07-22 18:42:48 +03:00
RW c0116f445f
Update ctx.md
Add hint for references to GetReqHeaders
2023-07-20 16:47:39 +02:00
RW 3b08646abf
Update ctx.md
Add additional documentation for GetRespHeaders
2023-07-20 16:43:49 +02:00
Štefan Baebler f1ff0f45c8
📚 Doc: Fixed link to slim template engine (#2547)
docs: fixed link to slim template engine
2023-07-18 11:57:06 +02:00
RW f6446ab0b9
Update log.md 2023-07-16 16:18:23 +02:00
f1rstmehul 08099b0635
📚 Docs: Fix link (#2542)
fix link
2023-07-15 20:20:29 +02:00
RW a9933f50c5
Update intro.md 2023-07-09 18:52:51 +02:00
René Werner 032bde9452 use new template docs in fiber docs 2023-07-08 21:33:15 +02:00
z3ntl3 80fc222646
- fixed validation-guide (#2517)
* - fixed validation-guide

* 06/23/2023 14:39:08 - small update

* 06/23/2023 14:51:31

* 06/23/2023 14:53:47

* ()

* ()

* 06/25/2023 18:07:46 fix naming

* 06/26/2023 09:31:57

* 06/26/2023 09:35:39 - fix indentation

* 06/26/2023 09:37:48 - formatted with go fmt

* 06/27/2023 19:24:42 - update to v10

* 06/27/2023 19:27:17 - update validator to v10

* 06/27/2023 23:38:38 - fix var name

* 06/27/2023 23:40:47 - fix var name
2023-06-28 00:49:32 +03:00
Iliya 5c1e8a9cff
📚 Docs: fix bad documentation on queries function (#2522) 2023-06-27 17:20:50 +02:00
Ruan Heyns f68ec0dfbb
Update ctx.md: Add a warning on security implications when using X-Forwarded-For improperly (#2520)
Update ctx.md

Add a warning on security implications when using X-Forwarded-For improperly
2023-06-26 10:24:50 +02:00
Jiun Lee fefc533834
🚀 Add Logger interface and fiberlog (#2499)
* add log for fiber

* replace log in fiber

* add Log use to adapt for log libraries

* Update app.go

Co-authored-by: Tomás Warynyca <41587659+tomaswarynyca@users.noreply.github.com>

* wip: add log docs

* add WithLogger use to print key and value

* remove CtxLogger and add WithContext use to bind Context

* fix errcheck

* fix errcheck

* update log.md

---------

Co-authored-by: Tomás Warynyca <41587659+tomaswarynyca@users.noreply.github.com>
2023-06-26 08:16:57 +02:00
W. Xiaoyun 040aac94c6
✏️ Fix: typo in ctx.md (#2516)
Fix: typo in ctx.md
2023-06-23 11:44:52 +02:00
RW 1603a148fe
Update logger.md 2023-06-22 13:21:14 +02:00
RW b308b2b7a6
Update logger.md
correct spacings
2023-06-22 13:07:33 +02:00
cmd777 1b060cb150
🩹 Fix: default logger color behaviour (#2513)
* Fix logger colors

* Fix tests
Basically add ˙enableColors: true˙ back to default config
2023-06-22 13:06:37 +02:00
RW 2eaeb0f3f7
Update hooks.md
correct docs syntax error
2023-06-19 13:24:41 +02:00
SamanDev ed95fa8c7e
🔥 Feature: add ability to print custom message on startup (#2491)
* feat: add a variadic parameter on OnListenHandler

* feat: accept a variadic ListenData in startupProcess parameters

* feat: add startupProcess variadic ListenData to function

* refactor: use runOnListenHooks instead of startupProcess for run onListenHooks

* refactor: remove variadic to make codes straightforward

* fix: add listen data to runOnListenHooks

* test: add listenData parameter to OnListen tests

* docs: update OnListen docs

* fix: remove unused codes

* docs: add tabs to onListen hook example

* docs: add if statement to docs example

* docs: replace fmt with log

* docs: fix return value of example

* docs: make 0.0.0.0 string a constant

* fix: change type of TLS from string to bool

* fix: return bool instead of a string

* docs: update example with new TLS type

* fix: change name tls to isTls to prevent shadowing tls variable

* style: make syntax of onListen example shorter

* refactor: remove unused no-lint comment

* refactor: change isTls to isTLS

* fix: add nolint for isTLS bool param

* Update listen.go

---------

Co-authored-by: M. Efe Çetin <efectn@protonmail.com>
2023-06-19 13:11:22 +02:00
我的名字叫浩仔 3dc9e1df80
🐛 bug: fix docs api fiber custom config (#2510)
fix: docs api fiber custom config

Co-authored-by: haoc <haoc@opera.com>
2023-06-19 12:22:55 +02:00
RW 9bcdb560dc
Update ctx.md 2023-06-19 10:49:25 +02:00
RW 204b01aeb2
Update ctx.md 2023-06-19 10:47:45 +02:00
RW fa5935b7e9
Update ctx.md
reformat queries docu
2023-06-19 10:43:15 +02:00
RW f86423d625
Update ctx.md
reformat ctx.Queries() example
2023-06-19 10:41:53 +02:00
Iliya d87065f5f2
🚀 FEATURE: add queries function (#2475)
* 🚀 FEATURE: add queries method

* 📚 DOCS: add documents for queries method.

* 🩹 Fix: fix wrap error returned from Queries function

* 🚨 tests: add url encoded tests

* 🔥 feature: add url encoded support for queries

* 🩹 Fix: fix wrap error returned from Queries function

* ♻️ Refactor: change error message of url.QueryUnescape

* ♻️ Refactor: refactor of mapping key and value queries

* 🚨 Test: Validate to fail parse queries

* 🚨 Test: Add benchmark test for Queries

* 🩹 Fix: remove parsing for encoded urls

* ♻️ Refactor: change string function to c.app.getString fucntion

Co-authored-by: cmd777 <83428931+cmd777@users.noreply.github.com>

* ♻️ Refactor: change name of benchamark function ctx queries

Co-authored-by: leonklingele <git@leonklingele.de>

* ♻️ Refactor: remove empty lines

Co-authored-by: leonklingele <git@leonklingele.de>

* Revert "♻️ Refactor: change string function to c.app.getString fucntion"

This reverts commit 28febf9e60.

* 📚 Docs: add documents for queries method

* 🚨 Tests: add more tests for queries function

* ♻️ Refactor: change string function to c.app.getString function

* 🚨 Tests: add more test for queries function

* 📚 Docs: add more documents to queries function

---------

Co-authored-by: cmd777 <83428931+cmd777@users.noreply.github.com>
Co-authored-by: leonklingele <git@leonklingele.de>
2023-06-12 07:51:57 +02:00
M. Efe Çetin f5d2abb948
📝 docs: update version of html template (#2505) 2023-06-10 17:16:11 +03: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
Anzhi 06ef450a8a
🚀 Add DisableColors to set the default output format (#2493)
Add DisableColor for default logger format
2023-06-05 13:20:45 +02:00
leonklingele c56b4e66a0
middleware/adaptor: allow to convert fiber.Ctx to (net/http).Request (#2461) 2023-05-15 13:04:58 +02:00
M. Efe Çetin c7c37d9b50
♻️ refactor: merge some external middlewares to core (#2453)
* ♻️ refactor: merge adaptor, helmet, keyauth, redirect, rewrite middlewares to core

* fix linting issues

* fix linting issues

* fix linting issues

* update
2023-05-10 08:01:49 +02:00
bcd 3c3f12b76c
[Feature]: Add filesystem config contentTypeCharset support (#2438)
* Update filesystem.go

* Update filesystem_test.go

* Update filesystem.md

* fmt
2023-05-02 08:40:20 +02:00
RW ee2b13c8c0
Update timeout.md 2023-04-14 12:18:00 +02:00
RW 41b08b6cb0
Update faq.md 2023-04-14 11:36:57 +02:00
cmd777 3b7a7d491b
📚 Docs: Fix import and comma issues (#2410)
Fix import and comma issues
2023-04-13 12:32:39 +08:00
James Lucas 866d5b7628
feat(cors): Added new 'AllowOriginsFunc' function. (#2394)
*  feat(cors): Added new 'AllowOriginsFunc' function.

* feat(cors): Added warning log for when both 'AllowOrigins' and 'AllowOriginsFunc' are set.

* feat(docs): Updated docs to include note about discouraging the use of this function in production workloads.

---------

Co-authored-by: RW <rene@gofiber.io>
2023-04-11 10:24:29 +02:00
RW fcf708dfc2
Update routing.md 2023-04-10 12:31:49 +02:00
RW c396d2aa45
Update grouping.md 2023-04-10 12:28:57 +02:00
cmd777 8b1f9260a3
📚 Docs: Fix typos, and make middleware documentation more consistent (#2408)
Fix typos, and make docs more consistent
This fixes several typos in the ISSUE_TEMPLATES, as well as improve
their readability, also makes the documentation markdowns more
consistent
2023-04-10 10:48:12 +08:00
Hakan Kutluay 22b407e2e7
🐛 [Bug-Fix] add original timeout middleware (#2367)
* add original timeout middleware

* fix linter issues

* deprecate original timeout middleware

* update timeout middleware documentation
2023-04-09 16:05:51 +02:00
Juan C. Yamacho H 562d15db86
🚀 Feature: Public ShutdownWithContext (#2407)
* feat: public shutdown with context

* docs: add server shutdown option

* chore: revert spacing changes

* test: app shutdown with context
2023-04-09 21:08:03 +08:00
Shahriar Sohan 74a9fa96f5
docs: added code link to fiber config fields (#2385)
* docs: added code link to fiber config fields

* docs: added code link to fiber config fields [reference line link updated]

* docs: added code link to fiber config fields [reference line link updated]

* removed reference line link from docs

* docs/api: fix indentation

---------

Co-authored-by: leonklingele <git@leonklingele.de>
2023-04-04 11:12:53 +02:00
RW e9541945e5
Update faq.md 2023-03-31 12:36:30 +02:00
RW 856332c16a
Update faq.md 2023-03-31 12:35:20 +02:00
João Vitor 5eb4d57d88
feat: adding to fac sub domain routing 📝 (#2393)
* feat: adding to fac sub domain routing

* update: docs to include a example

* Update faq.md

* fix code after tests

---------

Co-authored-by: RW <rene@gofiber.io>
2023-03-31 12:29:14 +02:00
Iliya bf31f1f3c6
💊 Change default value of Querybool from true to false. (#2391)
* 🩹 Fix QueryBool function: change default value from true to false

* 📚 Update QueryBool function document

* Update ctx.md

---------

Co-authored-by: RW <rene@gofiber.io>
2023-03-30 13:26:26 +02:00
René Werner c9121189a9 Fix docu 2023-03-24 18:58:15 +01:00
René Werner cc5c793d83 Add documentation for ctx.QueryFloat and ctx.QueryBool 2023-03-24 18:54:09 +01:00
René Werner 1f52799686 Refresh middleware documentation 2023-03-24 13:23:52 +01:00
Kyle Manning 32c3961726
corrected coding typos in MountPath docs section (#2379)
* corrected coding typos in MountPath docs section

* Update app.md

---------

Co-authored-by: Kyle Manning <kyle@manning.jp>
Co-authored-by: M. Efe Çetin <efectn@protonmail.com>
2023-03-22 09:44:36 +03:00
M. Efe Çetin 9064eb6469
🧹 chore: drop go 1.16 support & update dependencies (#2374)
* 🧹 chore: drop go 1.16 support

* downgrade uniseg

* fix tests

* fix tests

* fix tests
2023-03-20 08:22:31 +01:00
Benjamin Grosse d7b36cde54
🐛 requestid.Config.ContextKey is interface{} (#2369)
requestid.Config.ContextKey is interface{}

Consistent with c.Locals(key inteface{}, ...).
Fixes #2356
2023-03-14 19:37:10 +01:00
RW 0dee42a57c
Update ctx.md ip documentation 2023-03-14 11:24:11 +01:00
Tumushimire Yves 634f163e3f
🚀 [Feature]: SessionOnly when cookie.Expires is 0 (#2152)
* feature: session only for zero expire cookie #2145

* refactor condition to set MaxAge and Expire on cookie

* move checking zero maxage and expire in session middleware

Signed-off-by: Yves Tumushimire <yvestumushimire@gmail.com>

* feature: session only for zero expire cookie #2145

* refactor condition to set MaxAge and Expire on cookie

* move checking zero maxage and expire in session middleware

Signed-off-by: Yves Tumushimire <yvestumushimire@gmail.com>

* CR changes

* some updates

---------

Signed-off-by: Yves Tumushimire <yvestumushimire@gmail.com>
Co-authored-by: Muhammed Efe Çetin <efectn@protonmail.com>
Co-authored-by: René Werner <rene.werner@verivox.com>
2023-03-12 19:14:22 +01:00
Hong Seungwoo c1c119337f
Fix typo in docs (#2357)
Co-authored-by: Seungwoo Hong <qksn1541@hits.ai>
2023-03-08 17:59:36 +03:00
Muhammed Efe Çetin 15e9235383
📝 docs: remove README.mds from middleware dirs 2023-03-06 16:42:35 +03:00
lublak 2e7e879d6f
feature: allow preloaded certs with prefork (#2351)
* allow preloaded certs with prefork

* add to documentation

* add comments for ListenMutualTLSWithCertificate

* add test for WithCertificate

* Update benchmark.yml

* Update benchmark.yml

* Update benchmark.yml

* Update benchmark.yml

* Update benchmark.yml

* Update benchmark.yml

---------

Co-authored-by: RW <rene@gofiber.io>
2023-03-06 12:03:41 +01:00
René Werner f6b5ed6d26 update proxy docs 2023-02-25 10:57:12 +01:00
René Werner 35e6825614 update proxy docs 2023-02-25 10:55:27 +01:00
René Werner bfa8b6a222 Merge remote-tracking branch 'origin/master' 2023-02-25 10:44:08 +01:00
M. Efe Çetin a1eb0e69a6
📝 docs: fix example on envvar middleware 2023-02-25 12:43:57 +03:00
René Werner d034115dec optimize workflows and test docs sync 2023-02-25 10:43:53 +01:00
M. Efe Çetin b3643198f8
📝 docs: automated synchronization with `gofiber/docs` (#2344)
Automated Synchronization with gofiber/docs repo
2023-02-25 10:29:07 +01:00
Fenny 3d710a7602 Move docs to separate repository 2020-02-05 22:43:01 +01:00
Fenny 30d0be1e68 Fix docs 2020-02-05 22:34:36 +01:00
Fenny 73835d1807 Exclude some folders from go 2020-02-05 22:28:17 +01:00
Fenny 1fe84e59a4 Add FakeRequest to doc 2020-02-05 18:00:35 +01:00
Fenny bda065478c Edit Doc 2020-02-05 13:26:20 +01:00
Fenny 36efef1f61 v1.3.3 2020-02-05 12:16:21 +01:00
Fenny cfe08a74d3 Edit docs 2020-02-05 12:15:11 +01:00
Fenny ae132e61ed Fix js func 2020-02-05 01:20:45 +01:00
Fenny 6d0e4257e8 Fix import typo 2020-02-05 01:17:31 +01:00
Fenny 3b3dba3fcb Seo and mobile optimization 2020-02-05 01:10:49 +01:00
Fenny 6e1fa09bde Add https://fiber.wiki 2020-02-05 00:42:13 +01:00
Fenny b75bd63aeb Create CNAME 2020-02-04 18:07:00 +01:00
Fenny 3bb1fb9b4c Fix typo 2020-02-04 15:00:33 +01:00
Fenny 40eb4d8f18 Fix coverpage 2020-02-04 14:32:48 +01:00
Fenny 0d3cdef8f1 Fix coverpage 2020-02-04 14:24:42 +01:00
Fenny 7e5e80846b
Merge pull request #23 from Fenny/master
Coverpage fix
2020-02-03 10:25:30 -05:00
Fenny 894ffa3f5c Coverpage fix 2020-02-03 16:25:07 +01:00
Fenny c0f8b802b5
Merge pull request #22 from Fenny/master
Coverpage
2020-02-03 10:24:32 -05:00
Fenny d08ffbd40e Coverpage 2020-02-03 16:24:06 +01:00
Fenny 14c81b47fb
Merge pull request #21 from Fenny/master
Add gitter community
2020-02-03 10:21:07 -05:00
Fenny 44dee4015a Add gitter community 2020-02-03 16:20:41 +01:00
Fenny 4f651a2c55
Merge pull request #18 from Fenny/master
Change example to use Middleware
2020-02-03 09:55:28 -05:00
Fenny 4e5f263cb7 Change example to use Middleware 2020-02-03 15:55:03 +01:00
Fenny 2846b73766
Merge pull request #17 from Fenny/master
Add landing page to docs
2020-02-03 09:50:40 -05:00
Fenny 65be8ea7e6 Remove _navbar 2020-02-03 15:49:53 +01:00
Fenny 49d762eaf7 Add landing page to docs 2020-02-03 15:49:17 +01:00
Vic Shóstak 99d1d59e36
Tiny file size by SVGO 2020-02-03 17:11:45 +03:00
Vic Shóstak 469a354ed7
Add China flag 2020-02-03 16:17:27 +03:00
Fenny ef1b7d7448 Fix typo in doc example 2020-02-03 13:52:36 +01:00
Fenny 26d3283303 Fix typo in doc navbar 2020-02-03 13:50:36 +01:00
Fenny f6489b7405 Deprecated messages, linting, nosec, typo's 2020-02-03 13:40:50 +01:00