1
0
mirror of https://github.com/gofiber/fiber.git synced 2025-02-22 22:23:42 +00:00

224 Commits

Author SHA1 Message Date
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
Jinquan Wang
9c98a1fb37
🐛 bug: Case sensitivity for parameters in GetRouteURL (#2010)
* 🐛 bug: Case sensitivity for parameters in GetRouteURL

* ✏️ perf: error spell
2022-08-24 09:16:19 +02:00
George Bolo
8540d0afdc
fixes #2016 - make IP() and IPs() more reliable (#2020)
* fixes #2016 - make IP() and IPs() more reliable

* improve the performance of IP validation functionality

* refactor IP validation and make it a configuration option
2022-08-23 08:32:21 +02:00
Thomas
2edcf95f57
update: tls.ClientHelloInfo in Ctx (#2011)
* Update go.mod

* wip

* wip

* wip

* wip

* wip

* Move tlsHandler from Config to App

* Use NewError instead of panic

* Add a test with ServerName

* Add some tests on ClientHelloInfo

* fix missing import

* remove unnecessary ctx field.

Co-authored-by: RW <rene@gofiber.io>
Co-authored-by: Muhammed Efe Çetin <efectn@protonmail.com>
2022-08-19 08:19:22 +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
olongfen
bad7001570
binds the param string to a struct use params tag (#1968)
* add: params parse

* fix: binds the param string to a struct use params tag
2022-07-06 12:42:54 +02:00
olongfen
dfa24a0958
add: params parse (#1964) 2022-07-05 13:45:11 +02: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
Artem Avanesov
061c2a9e12
fix typo for paramsInt function (#1913) 2022-05-24 02:05:55 +02:00
dependabot[bot]
bf0673eb95
Bump github.com/valyala/fasthttp from 1.35.0 to 1.37.0 (#1882)
* Bump github.com/valyala/fasthttp from 1.35.0 to 1.36.0

Bumps [github.com/valyala/fasthttp](https://github.com/valyala/fasthttp) from 1.35.0 to 1.36.0.
- [Release notes](https://github.com/valyala/fasthttp/releases)
- [Commits](https://github.com/valyala/fasthttp/compare/v1.35.0...v1.36.0)

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

Signed-off-by: dependabot[bot] <support@github.com>

* Bump github.com/valyala/fasthttp from 1.35.0 to 1.36.0 #1882

* Bump github.com/valyala/fasthttp from 1.35.0 to 1.36.0 #1882

* Bump github.com/valyala/fasthttp from 1.35.0 to 1.36.0 #1882

* Bump github.com/valyala/fasthttp from 1.35.0 to 1.36.0 #1882

* Bump github.com/valyala/fasthttp from 1.35.0 to 1.36.0 #1882

* Bump github.com/valyala/fasthttp from 1.35.0 to 1.37.0 #1882

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: wernerr <rene@gofiber.io>
2022-05-18 08:16:19 +02:00
ChandanChainani
941ada9f05
Fix cannot process array of values in application/x-www-form-urlencoded request (#1873)
* Renamed parseQuery to parseParamSquareBrackets

* Added square brackets processing for `application/x-www-form-urlencoded`

* Added test cases for Array of form values
2022-04-24 12:25:36 +02:00
TomRomeo
bea756f624
✏️ Typo fix in ParamsInt() (#1863) 2022-04-16 15:32:25 -04:00
RW
e9151e8ab8
Revert " feature: add SendFileWithConfig method to ctx (#1852)" (#1861)
This reverts commit f19ef67f73f140a92e7359fdf83acabc6a5db094.
2022-04-15 15:54:18 +02:00
M. Efe Çetin
c42af6d2ca
feature: support adding queries to RedirectToRoute (#1858)
* Support adding queries for RedirectToRoute method.

* fix security check.

*  feature: support adding queries to RedirectToRoute

Co-authored-by: wernerr <rene@gofiber.io>
2022-04-15 15:32:39 +02:00
M. Efe Çetin
f19ef67f73
feature: add SendFileWithConfig method to ctx (#1852)
* add sendfilewithconfig.

* update

* shortify code.
2022-04-14 10:49:48 +02:00
M. Efe Çetin
a63a842fb6
add allparams method. (#1853) 2022-04-14 10:48:41 +02:00
M. Efe Çetin
ee65ea5bab
🧹 Use encoding/json (#1851)
* remove goccy/go-json

* fix tests.
2022-04-13 10:45:33 +02:00
Andrey Kuvshinov
16b8717a29
Add context Writef feature function (#1841) 2022-04-01 19:15:06 +02:00
Neenad Ingole
44bfdc3d6b
🩹 Allow parsing of square bracket query param (#1818) 2022-03-22 09:13:56 +01:00
Sujit Baniya
af339a851f
Change name to get URL from (#1831)
* 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>

Co-authored-by: RW <rene@gofiber.io>
Co-authored-by: hi019 <65871571+hi019@users.noreply.github.com>
2022-03-22 09:13:30 +01:00
Geet Manghnani
a746e5bfb8
Restore Original URL of the context after changing it (#1788)
* Restore original URL after the proxy

* Use the Immutable string to restore

* Changing deprecated ImmutableString to CopyString

Co-authored-by: Geet Manghnani <gmanghna@in.ibm.com>
2022-02-20 21:59:47 +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
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
Abhishek Mehandiratta
68fcd8c88f
Feature: Session Only Cookies (#1752)
* feat(ctx): add SessionOnly property on Cookie struct

* feat(middleware/config): add CookieSessionOnly property on middleware Config struct

* feat(csrf): link config CookieSessionOnly with fiber.Cookie in create middleware function

* fix(ctx_test): add tests for SessionOnly cookie in test_ctx_cookie

* fix(readme): update readme in csrf middleware for CookieSessionOnly property

* remove deprecated property from CookieSessionOnly explaination comments
2022-02-07 13:35:00 +01:00
M. Efe Çetin
c450072f4a
🐛 fix: mounted app views (#1749)
* Fix mounted app views.

* Cleaner structure.

Co-authored-by: RW <rene@gofiber.io>

* remove unnecessary lines.

* Add test case for group-with-mount, remove unnecessary lines.

Co-authored-by: RW <rene@gofiber.io>
2022-02-06 14:58:45 +01:00
Matthias Neugebauer
8853190031
🔥 Feature: Add ability to restart route handling (#1739)
* 🔥 Feature: Add ability to restart route handling

* Change test names

Co-authored-by: RW <rene@gofiber.io>
2022-02-03 15:09:46 +01:00
Aliqyan Tapia
39a503cc1d
🚀 SaveFile to default External Storage (#1557)
* fiber change

* reference correct storage in SaveFile

* seperate logic to new function

* Change storage defination style, fix tests on go1.14

* Add unit test.

Co-authored-by: Alex Bakker <abakks@hotmail.com>
Co-authored-by: M. Efe Çetin <efectn@protonmail.com>
2022-02-03 14:09:11 +01:00
M. Efe Çetin
a51ec9bc69
🔥 Feature: Add ReqHeaderParser. (#1721)
* Add ReqHeaderParser.

* Cleanup and tidy up parser codes.

Co-authored-by: RW <rene@gofiber.io>

* Add benchmark for ReqHeaderParser.

* Revert collectVisitAllData

Co-authored-by: RW <rene@gofiber.io>
2022-01-24 20:41:37 +01:00
kingdevnl
82d1039416
feature: Pass all locals to ctx.Render (#1693)
* feature: Pass all locals to ctx.Render

* add test case for render using locals

* Added option PassLocalsToViews to enable pass locals to render

The option PassLocalsToViews is set to disabled by default

* Added a check to see if the ctx bind already contains the value

* Added a test for ctx render with locals and binds.
2022-01-24 08:29:46 +01:00
hi019
eee279bdb3
Fix using IP ranges in config.TrustedProxies (#1607) (#1614)
* Fix using IP ranges in config.TrustedProxies (#1607)

* Add tests

* Remove debugging var

* Remove tests

* Update test

Co-authored-by: RW <rene@gofiber.io>
2021-12-31 18:32:39 +01:00
M. Efe Çetin
59240b5493
Add GetRespHeader, GetReqHeaders and TagReqHeaders for logger mw (#1678)
* Add GetRespHeader & GetReqHeaders methods.

* Add TagReqHeaders for logger middleware.

* Update README.md
2021-12-31 13:03:08 +01:00
vecpeng
bd19adc2c7
🔥Feature: add function to check if request came from localhost (#1671)
* 🔥Feature: add function to check if request came from localhost

* 🔥Feature: add function to check if request came from localhost
2021-12-28 16:02:25 +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
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
Rock
a9b66b328e
♻️ Option to overide form decoder setting - Rename function (#1555)
* 🔥 add function to overide form decoder setting

🔥 Feature : SetBodyParserDecoder map all option to form decoder, use with BodyParserConfig, BodyParserType

🚨 Test : Test_Ctx_BodyParser_WithSetBodyParserDecoder

* 🔥 Use decoder builder function with default setting on init decoderPool

* ♻️ rename SetBodyParserDecoder to SetParserDecoder

BodyParserType > ParserType
bodyParserConfig > parserConfig
BodyParserConfig > ParserConfig
2021-10-04 08:37:24 +02:00
Rock
35e38db771
🔥 Add function to override form decoder setting (#1100)
* 🔥 add function to overide form decoder setting

🔥 Feature : SetBodyParserDecoder map all option to form decoder, use with BodyParserConfig, BodyParserType

🚨 Test : Test_Ctx_BodyParser_WithSetBodyParserDecoder

* 🔥 Use decoder builder function with default setting on init decoderPool
2021-10-01 08:32:06 +02:00
Iván Valdés
26c29e248f
Restore original URL after sending file (#1553) 2021-10-01 08:30:47 +02:00
Thammachart Chinvarapon
842b63022d
🐛 Fix Mutability issue of UserContext in fiber.Ctx (#1522)
* existing tests clean up

* concurrent test for UserContext Reused

* comment on Ctx.userContext field

* userContext tests edited & fixed, userContext field removed, constant of userContextKey defined
2021-09-09 08:11:26 +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
Pranay
670170f7c5
📝 Update: Add JSONDecoder to config (#1489)
* 📝 Update: Add JSONDecoder to config
2021-08-18 14:26:07 +02:00
goldwind-ting
846d5a5b38
[Logger]: add tag for response header (#1446)
* add TagRespHeader to get response header

* #1422:add unittest

* #1422:adjust docs for logger middleware

* #1422:adjust docs for logger middleware
2021-08-04 08:19:41 +02:00
faceair
1e0d4d3b1c
🐛 fix parse gzipped body (#1458) 2021-07-30 08:02:02 +02:00
Vahagn Mkrtchyan
f0ab2a5433
Add option to specify default values for ParamsInt (#1453) 2021-07-26 19:50:56 +02:00
Marcos de Oliveira
30ba99425f
Add ${port} logger variable (#1448)
* Add c.Addr() and c.Port() functions and logger port variable

* Add gofmt suggestion, README.md description and test

* Remove c.Addr() func and use c.fasthttp.RemoteAddr() instead
2021-07-22 17:42:29 +02:00
wja513
dd45be693a
cookie: add possibility to disable same site attribute (#1428)
* fix some old browsers cann't set the cookie if it contains SameSite property.

* add "SameSite" attribute constants and test case.

Co-authored-by: wangjiangao <wangjiangao@360.cn>
2021-07-16 20:08:17 +02:00
Oleg Roshnivskyy
5ba78cd24a
🔥 Feature: Add TrustedProxies feature (#1397)
* 🔥 Feature: Add TrustedProxies feature

Add TrustedProxies feature to prevent HTTP header spoofing.

* Update ctx.go

* Update app.go

* Update app.go

Co-authored-by: hi019 <65871571+hi019@users.noreply.github.com>
2021-06-30 08:03:45 +02:00
Andreas
2703e92c5d
Added decompression cases for Body function (#1402)
* Added decompression cases for Body function

* Fixed signature of Body() function

* Removed regex, added Header.Peek

* Added test case with compression

* Added Benchmark, moved compression names to helpers and made them constants

* Added long brotli as a constant

* Update ctx.go

improve Body function

* Update ctx.go

improve performance

* Fixed formatting

* Update helpers.go

Co-authored-by: RW <rene@gofiber.io>
2021-06-24 07:47:21 +02:00
Sujit Baniya
cb5f2f7eab
🔥 Add Global ViewLayout (#1384)
* Add Global Layout for view render

* Add test case for Views Layout

* Update ctx_test.go
2021-06-14 11:10:49 +02:00
Kshitij Patil
8616b41517
🔥 Adding user context (#1341)
* Adding user context

* adding docblock

* correcting comments

* minor change in comment

* Update ctx.go

Co-authored-by: RW <rene@gofiber.io>
2021-05-24 00:46:52 -04:00
SianLoong
da1877f16c
🏗️ chore: enable decoder's ZeroEmpty by default (#1285) 2021-05-17 15:46:36 +02:00