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

105 Commits

Author SHA1 Message Date
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
Vishal Rana
8b5772cf65 Proper header and MIME constants
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-04-06 07:29:47 -07:00
Vishal Rana
28ec39daaa Context#StaticContent signature changed
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-27 21:03:35 -07:00
Vishal Rana
a2d757eddc Closes #434
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-27 16:29:41 -07:00
Vishal Rana
a66162a3d2 Logging middleware fixes
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-21 17:27:14 -07:00
Vishal Rana
703174e58f Context#Form() > Context#FormValue(), Context#Query() > Context#QueryParam()
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-21 13:10:20 -07:00
Vishal Rana
c4caeb8ffb more godoc
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-19 15:47:20 -07:00
Vishal Rana
ac25928fd0 Closes #393
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-12 11:49:45 -08:00
Vishal Rana
09f3d3061f Closes #314
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-11 07:53:54 -08:00
Vishal Rana
f4a5abc8b2 Removed Context#Socket
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-08 08:14:25 -08:00
Vishal Rana
a9c88cad63 Fixed #310
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-05 20:03:11 -08:00