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

139 Commits

Author SHA1 Message Date
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
Vishal Rana
687f05470a Zhaojkun httperror message (#959)
* Change echo http error message

* Add test case

* Fixed test cases

Signed-off-by: Vishal Rana <vr@labstack.com>
2017-06-20 08:58:53 -07:00
Vishal Rana
c05db06020 Fixed #947, closes #948
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-06-07 08:23:43 -07:00
Sub
0dfcb31d9e Automatically use JSONPretty/XMLPretty if '?pretty' in querystring (#916)
* Automatically use JSONPretty/XMLPretty if '?pretty' in querystring

* Update unit test cases

* Simplify code according comments

* Update guide for pretty json/xml
2017-04-27 21:41:46 -07:00
Vishal Rana
29fd5831ff Fixed test
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-02-22 15:57:12 -08:00
Vishal Rana
069e80b9e0 Mention about custom listener
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-01-18 12:17:44 -08:00
Vishal Rana
9797cf4b9c gc
Removed graceful shutdown, fixed #797

Signed-off-by: Vishal Rana <vr@labstack.com>
2017-01-13 18:40:27 -08:00
Vishal Rana
5706940bc8 HTTPError#Message is now interface
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-12-10 22:05:41 -08:00
Vishal Rana
0e7a9c1d49 exposed default binder, tag for binding query params
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-12-10 09:06:29 -08:00
Vishal Rana
20954afd66 fixed json, xml pretty print
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-12-09 11:13:55 -08:00
Vishal Rana
093e5c9ed6 updated recipes
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-10-20 16:57:31 -07:00
Vishal Rana
d5b3fef5c9 removed deprecated functions group.go
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-10-13 14:04:08 -07:00
Vishal Rana
15eb5b0aad removed embedded context and exposed SetRequest in context
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-10-10 17:31:26 -07:00
Vishal Rana
0349e883f5 Moved logger to root
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-09-25 13:14:18 -07:00
Vishal Rana
dd22cf9593 Updated deps
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-09-25 11:41:08 -07:00