1
0
mirror of https://github.com/labstack/echo.git synced 2024-11-24 08:22:21 +02:00
Commit Graph

153 Commits

Author SHA1 Message Date
Martin Desrumaux
fbfe2167f1
fix(DefaultHTTPErrorHandler): return error message when message is an error (#2456)
* fix(DefaultHTTPErrorHandler): return error message when message is an error
2023-05-29 23:26:53 +03:00
Mihard
7d54690cdc
Proper colon support in reverse (#2416)
* Adds support of the escaped colon in echo.Reverse

---------

Co-authored-by: Mihard <mihard@webird.ru>
2023-04-16 21:13:47 +03:00
toimtoimtoim
45402bb393 Add echo.OnAddRouteHandler field. As name says - this handler is called when new route is registered. 2022-12-25 22:19:15 +02:00
toimtoimtoim
f1cf1ec930 Fix adding route with host overwrites default host route with same method+path in list of routes. 2022-12-25 22:19:15 +02:00
zeek
3c4d3b3083 Replace "io/ioutil"
"io/ioutil" pakcage has been deprecated since Go 1.16.
2022-11-21 15:59:14 +02:00
toimtoimtoim
be23ab67cc Add new method HTTPError.WithInternal 2022-11-19 23:05:16 +02:00
Martti T
1d5f335f40
refactor assertions (#2301) 2022-10-12 21:47:21 +03:00
Amir Hossein
666938e523
tests: error handling on closing body (#2254)
* tidy up tests
2022-09-14 08:40:39 +03:00
Martti T
690e3392d9
Add support for registering handlers for 404 routes (#2217) 2022-07-12 21:53:41 +03:00
Martti T
3f5b733425
Fix e.Static, .File(), c.Attachment() being picky with paths starting with ./, ../ and / after 4.7.0 introduced echo.Filesystem support (Go1.16+) (#2123)
* Fix `e.Static`, `.File()`, `c.Attachment()` being picky with paths starting with `./`, `../` and `/` after 4.7.0 introduced echo.Filesystem support (Go1.16+)
2022-03-13 15:05:12 +02:00
eric
6cb3b7c046
remove redundant 0 in make chan (#2101)
* remove 0 in make(chan,0) to fix go-staticcheck problem
2022-02-23 09:22:20 +02:00
toimtoimtoim
1b1a68fd4f Improve filesystem support (Go 1.16+). Add field echo.Filesystem, methods: echo.FileFS, echo.StaticFS, group.FileFS, group.StaticFS. Following methods will use echo.Filesystem to server files: echo.File, echo.Static, group.File, group.Static, Context.File 2022-01-24 15:55:16 +02:00
toimtoimtoim
5b26a5257b Allow header support in Router, MethodNotFoundHandler (405) and CORS middleware 2022-01-03 21:04:17 +02:00
Mohammad Alian
7d41537e70 return first if response is already committed in DefaultHTTPErrorHandler 2021-08-12 22:12:39 +03:00
Pablo Andres Fuente
f20820c003
Adding tests for Echo#Host (#1895) 2021-06-25 17:56:07 -03:00
Alexander Pochill
7846e3fa6b
feat: Bind data using headers as source (#1866)
Currently, echo supports binding data from query, path or body.
Sometimes we need to read bind data from headers. It would be nice to
automatically bind those using the `bindData` func, which is already
well prepared to accept `http.Header`.

I didn't add this to the `Bind` func, so this will not happen
automatically. Main reason is backwards compatability. It might be
confusing if variables are bound from headers when upgrading, and might
even have become a security issue as pointed out in #1670.

* Add docs for BindHeaders
* Add test for BindHeader with invalid data type
2021-05-25 14:50:49 +02:00
Martti T
a4ab482b60
Add Go 1.16 to CI and drop 1.12 specific code (#1850)
* Correct incorrect years in CHANGELOG.md
* CI tests with last 4 versions. Remove 1.12 and below specific code
* Rename proxy test
2021-04-16 11:38:12 +02:00
Martti T
67f6346df2
Fix Bind() when target is array/slice and path/query params complain target not being struct (#1835)
For path/query params binding we do not try (silently return) to bind when target is not struct.
Recreates PR #1574 and fixes #1565
2021-04-06 09:05:33 +02:00
Martti T
5622ecc180
Fix performance regression caused by path escaping (#1777, #1798, #1799)
* Fix performance regression #1777 and avoid double escaping in rewrite/proxy middleware.
* Add rewrite test for correct escaping of replacement (#1798)

Co-authored-by: Roland Lammel <rl@neotel.at>
2021-03-08 02:01:02 +01:00
Martti T
c79ffed7ce
Fix Echo.Serve() will not serve on HTTP port correctly when there is already TLSListener set to Echo instance. (#1785) (#1793) 2021-02-28 19:13:04 +01:00
Roland Lammel
716eb18329
Handle static routes with trailing slash (#1747)
- Fix Static file route not working without trailing slash
- Add tests for static middleware with/without trailing slash
- Add tests for static middleware under group

Co-authored-by: pwli <lipw0755@gmail.com>
2021-01-03 00:25:29 +01:00
toimtoimtoim
734e313f71 refactor Echo server startup to allow data race free access to listener address 2020-12-29 12:06:49 +02:00
Roland Lammel
e4fe8c8367 Fix failing tests on systems not supporting IPv6 2020-12-18 14:20:36 +01:00
toimtoimtoim
547ca5ca1e reverts #1671 changes 2020-12-17 02:20:26 +02:00
pwli
2374af470c
Update echo_test.go
fix typo
2020-12-16 09:37:26 +08:00
pwli
89ec0070b8
Merge branch 'master' into fix-conflict 2020-12-16 09:21:26 +08:00
little-cui
1beaf09740 Bug Fix: Directory Traversal 2020-12-15 21:54:11 +08:00
Pablo Andres Fuente
78fe2224b6 Merge branch 'master' into listener_network_configurable 2020-12-10 04:10:13 +00:00
Pablo Andres Fuente
5f1aa1bc07 Fixing Echo#Reverse for Any type routes
Fixes #1690
2020-11-24 03:24:27 +00:00
pwli
13374d1daa
add tests for Echo.Static() 2020-11-06 22:25:00 +08:00
Pablo Andres Fuente
4727bc6e99 Adding Echo#ListenerNetwork as configuration
Now Echo could be configured to Listen on tcp supported networks of
net.Listen Go standard library (tcp, tcp4, tcp6)
2020-11-05 05:09:17 +00:00
Roland Lammel
cdd946aaa0 Fix DefaultHTTPErrorHandler with Debug=true (#1477) 2020-11-05 03:37:15 +01:00
风吹过
28020c2a47
The directory path does not end with '/', it needs to be redirected (#1572)
* The directory path does not end with '/', it needs to be redirected

* changed guide highlighting to shell (#1593)

* Fix recover print stack trace log level (#1604)

* Fix recover print stack trace log level

* Add recover log level test

* Add default LogLevel to DefaultRecoverConfig

Co-authored-by: solym <ymwh@foxmai.com>
Co-authored-by: roz3x <52892437+roz3x@users.noreply.github.com>
Co-authored-by: Masahiro Furudate <178inaba.git@gmail.com>
2020-08-27 17:53:48 -07:00
Jonathan Hall
ea34bf9441 Add tests for HTTPError.Unwrap 2020-05-05 16:32:38 +02:00
Vishal Rana
fc4b1c0a83
Omit internal=<nil> in error strings (#1525) 2020-03-05 06:36:43 -08:00
ochan
c2f2e8d258
Support HTTP/2 h2c mode (cleartext) (#1489) 2020-01-28 14:46:00 -08:00
Vishal Rana
ed51400a81 Enhanced default http error handler
Signed-off-by: Vishal Rana <vr@labstack.com>
2019-08-01 22:52:42 -07:00
kolaente
858270f6f5 Added feature to map url params to a struct with the default binder (#1165)
* Added feature to map url params to a struct with the default binder

* Added test for mix of POST data and bound params

* Renamed variables

* Added error check

* Removed unneded fix
2019-06-21 06:12:55 -07:00
Mohamed Bana
8716acb0ab Echo.StartTLS: accept string or []byte as parameters. (#1277)
If `certFile` or `keyFile` is `string` the values are treated as file paths.
If `certFile` or `keyFile` is `[]byte` the values are treated as the certificate or key as-is.
2019-02-15 09:51:54 -08:00
Emir Ribić
c8fd197fa8 Replace http constants with stdlib ones, i.e.: http.MethodGet instead of echo.GET (#1205) 2018-10-14 20:46:58 +05:30
Emir Ribić
059c099762 simplify tests (#1206) 2018-10-14 12:48:44 +05:30
Thuc Le
f7470482fe Support internal error when Bind() data #888 (#1164) 2018-09-28 10:41:13 -07:00
Geon Kim
b369096cac echo: use HTTP status codes constants where applicable (#1184) 2018-08-28 18:40:40 -07:00
Alexandre Stein
af1bfd5397 Clean old Go versions 2018-04-03 08:40:03 -07:00
Alexandre Stein
3cdcc65b23 Add some tests 2018-03-01 12:08:34 -08:00
Evgeniy Kulikov
f49d166e6f [FIX] Cleanup code (#1061)
Code cleanup
2018-02-21 10:44:17 -08:00
Vishal Rana
70c18060bd Fixed #988, Closed #989
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-08-14 21:48:19 -07:00
Vishal Rana
b42edd791f Closes #980
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-08-02 23:16:11 -07:00
Guilherme Oenning
f8c3008787 Request: New bind property for route parameters (#973)
* bind route params

* rename to bindPathData
2017-07-25 07:22:19 -07:00
Nick Law
e0ea129c5c Expose echo.Add() for dynamic route registration (#965) 2017-07-03 19:10:58 -07:00