M. Efe Çetin
559f59f198
Add Route() method like Chi router. ( #1713 )
2022-01-24 16:37:28 +01:00
vecpeng
ef3a689600
🐛 fix: rename handlerCount to handlersCount ( #1674 )
2021-12-29 10:26:50 +01:00
M. Efe Çetin
68d3b773bc
Add route naming feature. ( #1650 )
...
* Add route naming feature.
* Update basicauth_test.go
* Fix gosec issues.
* Change RoutaName -> Name
* Fix race conditions.
* Update READMEs.
2021-12-28 14:04:04 +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
Jose Garcia
587f3ae9df
Support for sub fiber's error handlers ( #1560 )
...
- Mounted fiber and its sub apps error handlers are now saved a new
errorHandlers map in App
- New public App.ErrorHandler method that wraps the logic for which
error handler to user on any given context
- Error handler match logic based on request path <=> prefix accuracy
- Typo fixes
- Tests
2021-10-05 14:03:20 +02:00
Fufu
2c6ffb7972
Fix: register static file routing with trailing slash ( #1556 )
2021-10-05 10:55:11 +02:00
Fufu
b94870d886
Fix: static file routing path rewrite. ( #1538 )
...
* Fix: static file routing path rewrite.
* Add: static file routing test cases.
* Update: change os.CreateTemp to ioutil.TempFile for go1.14
* Update: optimize test cases.
2021-10-01 12:51:48 +02:00
ProExpertProg
dd153adfdb
Fix route.Path
on copy ( #1471 )
2021-08-05 07:32:05 +02:00
RW
34520e75f8
Fix - 🐛 The escape of special characters in route path does not work properly #1454 ( #1462 )
...
* Fix - 🐛 The escape of special characters in route path does not work properly #1454
2021-07-30 20:39:10 +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
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
bestgopher
056c6808af
Use atomic instead of mutex when counting the route handler. ( #1314 )
...
* use atomic instead of mutex when counting
* 📒 router: fix typo error
2021-05-05 17:53:54 +02:00
Joey
e89ef1207e
Merge pull request #1130 from mlukasik-dev/master
...
✨ add Next function to app.Static config
2021-01-31 07:54:54 +01:00
unknown
c62e5f7d4d
go style updates
2021-01-26 21:57:58 +03:00
ReneWerner87
42755c30e6
⚡ Accelerate start process for many routes #1081
2021-01-24 13:02:21 +01:00
Martin Lukasik
d602fc76e2
handling case when fiber.Static config is nil
2021-01-22 23:20:12 +01:00
Martin Lukasik
3a132d0b98
✨ add Next function to app.Static config
2021-01-22 23:07:22 +01:00
ReneWerner87
b51def0bb8
🐛 UnescapePath not working #1102
...
Co-authored-by: Fenny <fenny@gofiber.io>
2021-01-06 13:21:54 +01:00
Kiyon
a5a50ab020
👷 Remove redundant validation of CacheDuration when checking static config
2020-12-10 15:32:06 +08:00
Fenny
0d5519fc09
✨ expose CacheDuration in Static
2020-11-11 14:18:19 +01:00
kiyon
4c89377631
🩹 Fix #945
2020-10-21 14:50:33 +08:00
Roman
3e6dfb313b
🔥 set a Cache Control
header for static ressources
...
Right now, each static request returns the file without any cache control
header. If you are using `app.Static` to serve your assets, the
browser shouldn't cache it. This PR introduces a way to set the cache
control header (if the file was found) on the file response to set a
custom max-age to e.g. cache it 1 year.
2020-10-07 15:44:38 +02:00
Fenny
3b5997a3df
🔨 fix mount tree build
...
Co-Authored-By: RW <7063188+ReneWerner87@users.noreply.github.com>
2020-09-26 13:46:14 +02:00
Fenny
e414c4a83e
🗻 able to mount sub-apps
2020-09-26 11:24:25 +02:00
Fenny
ec5d20b1dc
Merge remote-tracking branch 'upstream/master'
2020-09-22 12:32:43 +02:00
kiyon
dba73ea45e
🧹 pass ErrMethodNotAllowed to handler
2020-09-21 08:45:17 +08:00
Fenny
2b72fd2162
🩹 ignore trailing slash with static directories
2020-09-20 21:48:45 +02:00
ReneWerner87
c822a17c72
☠️ Improve error handling flow
...
Co-authored-by: Fenny <fenny@gofiber.io>
Co-authored-by: Kiyon <kiyon@gofiber.io>
2020-09-18 20:44:00 +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
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
ad7f4df9a7
🦟 Fix star routes
2020-09-02 20:59:42 +02:00
ReneWerner87
2c6d7e00c4
🌵 hybrid routing with tree and fast router
2020-08-10 10:54:41 +02:00
ReneWerner87
df3c48a734
🌵 hybrid routing with tree and fast router
2020-08-10 10:51:38 +02:00
ReneWerner87
945b61d1c3
🌵 hybrid routing with tree and fast router
2020-08-09 21:53:15 +02:00
kiyon
cf22aa2ae5
🩹 handle invalid http method
2020-07-24 22:55:57 +08:00
Fenny
396b6ddebc
🗑️ Remove pos from Route
...
Co-Authored-By: RW <renewerner87@googlemail.com>
Co-Authored-By: kiyon <kiyonlin@users.noreply.github.com>
2020-07-22 02:07:57 +02:00
ReneWerner87
b34a77bc96
💉 Sync route method metadata
...
Co-authored-by: Fenny <fenny@gofiber.io>
2020-07-21 23:30:52 +02:00
Fenny
f681e2676f
🗑️ Deprecate app.Routes, introduce app.Stack
...
Co-Authored-By: RW <renewerner87@googlemail.com>
Co-Authored-By: kiyon <kiyonlin@users.noreply.github.com>
2020-07-21 22:50:46 +02:00
wernerr
b9bdc0d4a8
🚀 compress same route's handler
2020-07-20 19:29:54 +02:00
kiyon
174eb0e33d
🚀 compress same route's handler and sort routes when registering
2020-07-20 21:43:01 +08:00
Fenny
f9e6ea8103
🖇 Cleanup router chaining
2020-07-19 13:36:26 +02:00
ReneWerner87
1b2d3d92c4
🔗 Allow route method chaining
...
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/express-serve-static-core/index.d.ts#L119-L126
2020-07-19 10:04:21 +02:00
Fenny
da85c85c14
🧪 Increase test coverage: 96%
2020-07-15 17:43:30 +02:00
renanbastos93
e070968d2d
🚀 refactor: change status code number to constant
2020-07-14 00:55:41 -03:00
kiyon
2cfc1b1546
👷 Extract "USE" to a global const variable
2020-07-12 23:54:22 +08:00
kiyon
9b14fc78d1
💡 add ctx.matched to determine if request matched a non USE route.
2020-07-08 22:40:44 +08:00
ReneWerner87
d2e85a1eea
🚀 Better performance for MethodNotAllowed process
2020-07-08 13:42:10 +02:00
kiyon
ce3d44613c
🔧 fix #556 remove ctx.matched things
2020-07-07 23:25:02 +08:00
Fenny
964f3c59ae
🔨 Make Params available in Route
2020-07-05 11:17:42 +02:00