1
0
mirror of https://github.com/labstack/echo.git synced 2024-12-20 19:52:47 +02:00
Commit Graph

115 Commits

Author SHA1 Message Date
Wim
7544796946
Remove square brackets from ipv6 addresses in XFF (#2182)
Remove square brackets from ipv6 addresses in XFF
2022-11-24 22:17:31 +02:00
Kamandlou
534bbb81e3 replace POST constance with stdlib constance 2022-08-20 22:25:45 +03:00
Kamandlou
fb57d96a6d replace GET constance with stdlib constance 2022-08-20 22:25:45 +03:00
Oleksandr Savchenko
fdacff0d93 Split XFF header only by comma 2021-06-02 21:42:27 +03:00
Martti T
643066594d
Fix router not matching param route with trailing slash and implement matching by path+method (#1812)
* when url ends with slash first param route is the match (fix #1804)
* router should check if method is suitable for matching route and if not then continue search in tree (fix #1808)
2021-04-27 09:55:31 +02:00
Shubhendra Singh Chauhan
6a666acd5c
improve code quality (#1792)
* Merge variable declaration with assignment
* Fix unnecessary typecasting on `bytes.Buffer`
* Remove unnecessary wrapping of function call
2021-02-26 12:04:34 +02:00
Pablo Andres Fuente
b166376dd6 Merge branch 'master' into fix_router_find_after_invalid_set_param_values 2020-11-05 03:06:48 +00:00
Pablo Andres Fuente
23c21871b7 Fixed Router#Find panic an infinite loop
Before this fix, Router#Find panics or enters in an infinite loop when
the context params values were set to a number less than the max number
of params supported by the Router.
2020-10-28 04:30:41 +00:00
yonbiaoxiao
64c4950996 improve the test coverage for context.go 2020-09-16 10:37:45 +08:00
yonbiaoxiao
622f5e33d4 Use IndexByte instead of Split to reduce memory allocation and improve performance 2020-09-15 19:56:33 +08:00
178inaba
269dfcc9dd
Set maxParam with SetParamNames (#1535)
* Set maxParam with SetParamNames

Fixes #1492

* Revert go.mod
2020-03-30 12:28:07 -07:00
Dmitry Kutakov
712b5e46c5 format code (gofmt + trim trailing space) (#1452) 2020-01-25 09:48:53 -08:00
J. David Lowe
8d7f05e533 round-trip paramValues without exploding (#1463) 2020-01-23 18:32:17 -08:00
Alex Besogonov
5c7c87d09e Add ability to set the logger on echo.Context (#1377)
This change allows middleware to replace the logger on the echo.Context
with a customized per-request logger with additional fields. The logger
is reset to default on every Reset() call.
2019-11-11 12:34:13 -08:00
Vishal Rana
8fb7b5be27 Closes #1353
Signed-off-by: Vishal Rana <vr@labstack.com>
2019-06-27 10:52:17 -07:00
Noam Y. Tenne
fbb72869b3 Fix for #1334 (#1335)
* echo.context.cjson should encode the JSON before writing the status code #1334 :

`response.Write` automatically sets status to `200` if a response code wasn't committed yet. This is convenient, but it ignores the fact that `response.Status` is a public field that may be set separately/before `response.Write` has been called
A `response.Status` is by default `0`, or `200` if the response was reset, so `response.Write` should fallback to `200` only if a code wasn't set yet.

* echo.context.cjson should encode the JSON before writing the status code #1334 :

Writing the response code before encoding the payload is prone to error.
If JSON encoding fails, the response code is already committed, the server is able to only modify the response body to reflect the error and the user receives an awkward response where the status is successful but the body reports an error.
Instead - set the desired code on `c.response.Status`. If writing eventually takes place, the desired code is committed. If an error occurs, the server can still change the response.
2019-05-23 22:13:57 -07:00
Andrei Avram
be919e8f16 Increase Context tests coverage (#1279)
* Test context path.

* Test context handler.

* Test handler error.

* Text context validate.

* Test context query string.

* Test context undefined param.

* Test context request.

* Test context scheme.

* Test context is websocket.

* Test context multipart form params with error.

* Text context bind.

* Text context logger.

* Text context xml response write error.

* Test context real ip.
2019-02-19 10:18:42 -08:00
Andrei Avram
3d73323154 Use concurrency safe context by default. (#1158) 2019-02-12 10:56:26 -08:00
Vishal Rana
7867fce6ce Changes related to #1199
Signed-off-by: Vishal Rana <vr@labstack.com>
2019-01-14 10:56:17 -08:00
Evgeniy Kulikov
62145fad3e [extend #1191] Unnecessary alloc for XML, JSON, JSONP (#1199)
* [extend #1191] Unnecessary alloc for XML, JSON, JSONP

* add legacy (JSON/JSONP/XML)Blob tests

* fix namings

* fix `jsonPBlob` allocs

* fix review comments (thx @alexaandru)

* fix review comments (thx @alexaandru)
add benchmarks
2019-01-14 10:12:22 -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
Evgeniy Kulikov
f49d166e6f [FIX] Cleanup code (#1061)
Code cleanup
2018-02-21 10:44:17 -08:00
Vishal Rana
ec048ea523 Fixed #1052, dropped param alias feature
Signed-off-by: Vishal Rana <vr@labstack.com>
2018-01-30 19:02:29 -08:00
Vishal Rana
cec7629194 Fixed test for content disposition
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-08-24 08:57:36 -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
Ole Bulbuk
f0e3f950cf Tested and fixed bug with reused context (path parameters). 2017-03-30 12:05:24 +02:00
Vishal Rana
29fd5831ff Fixed test
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-02-22 15:57:12 -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
c5a3575d4c updated migration guide
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-11-14 22:54:09 -08:00
Vishal Rana
a739d9a0d9 - Removed Context#ServeContent
- Refactored Context#Attachment, Context#Inline,
  Context#ContentTypeByExtension

Signed-off-by: Vishal Rana <vr@labstack.com>
2016-10-25 14:53:47 -07:00
Vishal Rana
36251e88e2 router changes
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-10-21 20:36:49 -07:00
Vishal Rana
8623669cbc removed Context#P()
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-10-10 18:22:13 -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
2aec0353f5 First commit to v3, #665
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-09-22 22:56:00 -07:00
Vishal Rana
03efe4d61b Closes #525, closes #566, closes #573 (#653)
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-09-09 15:30:46 -07:00
Vishal Rana
00699ed0db Renamed Context#Context => Context#StdContext & Context#SetContext to ContextSetStdContext, 2d772e02ca
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-09-09 11:47:43 -07:00
Francisco Guimarães
8a85626a71 Inline feature (#637) 2016-08-22 14:46:21 -07:00
Vishal Rana
85e2816cf3 Minor formatting/changes
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-08-22 08:30:46 -07:00
Kazuhiro Kubota
48c42e7b90 Fix Context#SetContext()/Context#Context() 2016-08-22 20:42:25 +09:00
Vishal Rana
4e98fa9664 Fixed #500
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-06-06 09:47:22 -07:00
Vishal Rana
d0ed5830c4 Test coverage for cookie.go and context.go
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-06-05 22:25:34 -07:00
Vishal Rana
09a2ce60a6 About context #500
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-06-05 13:47:59 -07:00
Vishal Rana
f0526349ff Fixed #499
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-05-02 22:41:07 -07:00
Vishal Rana
190cf80d02 Fixed #432, Fixed #167.
Signed-off-by: Vishal Rana <vishal.rana@verizon.com>
2016-05-02 16:19:35 -07:00
Vishal Rana
cb752141f2 Add form binding
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-05-01 12:38:51 -07:00
Vishal Rana
be825e0229 Refactored variable names
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-04-24 10:22:15 -07:00
Vishal Rana
467cf05b41 Changes based on comments for #430
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-04-16 15:56:09 -07:00
Vishal Rana
b9aa2181b0 Trailing slash middleware with option to redirect
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-04-12 22:39:29 -07:00
Vishal Rana
609587e6eb Fixed #463
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-04-11 16:49:20 -07:00