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

198 Commits

Author SHA1 Message Date
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ć
a2d4cb9c7a Simplify REALIP method (#1193)
* Simplify REALIP method

* Remove alloc
2018-09-19 10:18:50 -07:00
Vishal Rana
a5d81b8d4a Updated deps, removed json-iterator, fixed #1087, fixed #1086
Signed-off-by: Vishal Rana <vr@labstack.com>
2018-03-16 10:00:59 -07:00
Vishal Rana
f4dde46fed Fixed build
Signed-off-by: Vishal Rana <vr@labstack.com>
2018-03-14 22:59:15 -07:00
Vishal Rana
003b0adaa5 Enhanced write content type
Signed-off-by: Vishal Rana <vr@labstack.com>
2018-03-14 22:51:06 -07:00
Vishal Rana
20ac716d4c Using json-iterator
Signed-off-by: Vishal Rana <vr@labstack.com>
2018-03-14 20:38:46 -07:00
Romain Gros
fb30777387 Return error of context.File in c.contentDisposition
context.Attachment and context.Inline use context.contentDisposition under the hood.
However, context.contentDisposition does not forward the error of context.File, leading to response 200 OK even when the file does not exist.
This commit forward the return value of context.File to context.contentDisposition to prevent that.
2018-03-06 10:50:53 -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
goofle
4df355113b Wrap Content-Disposition filename with quotes (#996) 2017-08-24 08:35:50 -07:00
Rene Jochum
0769b34b52 Use the NotFoundHandler when a file haven't been found. (#966)
This is especialy usefull when you use e.Static("/", "static") and you
want a notfoundhandler that serves your index.html like this:

echo.NotFoundHandler = func(c2 echo.Context) error {
	index := filepath.Join(c.config.StaticDir, c.config.Index)
	_, err := os.Open(index)
	if err != nil {
		return echo.ErrNotFound
	}
	return c2.File(path.Join(c.config.StaticDir, c.config.Index))
}

Another usecase with the Handler above is HTML5 SPF applications.

One caveat, you need to make sure that your NotFoundHandler doesn't
produce loops.

Signed-off-by: Rene Jochum <rene@jochums.at>
2017-07-19 11:29:41 -07:00
Vishal Rana
bd96cc3c15 Fixed #947
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-06-06 14:59:35 -07:00
Vishal Rana
c3887ebb13 Added Context#IsWebSocket(), proxy fix header
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-06-04 10:39:08 -07:00
TossPig
353a2f8b78 Get The HeaderXForwardedProto (#941)
* Get The HeaderXForwardedProto

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto

* add HeaderXForwardedSsl

* Get The HeaderXForwardedSsl
2017-06-04 09:41:17 -07:00
Vishal Rana
533d7a8dc1 Closes #918, docs updated for testing handler
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-04-29 11:02:57 -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
ac0a38d995 Fixed Context#RealIP() to fetch the first IP
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-04-20 12:05:09 -07:00
Vishal Rana
d5bff83dc3 Using *context instead of Context in Router#Find()
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-04-10 13:10:31 -07:00
Ole Bulbuk
f0e3f950cf Tested and fixed bug with reused context (path parameters). 2017-03-30 12:05:24 +02:00
Vishal Rana
22012e0e9d Fixed #833
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-03-26 20:15:48 -07:00
Vishal Rana
477d8dc708 Fixed #839
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-03-15 11:38:43 -07:00
Vishal Rana
c7c4395fbd Fixed #794
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-01-31 13:55:39 -08:00
Vishal Rana
54fb1015c1 Pretty print in debug mode
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-01-04 12:00:49 -08:00
Ted Kornish
eb7ebca112 Correct comment for Context.Response (#793) 2017-01-01 22:02:14 -08:00
Vishal Rana
294601a6ba docs: add guide/response
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-12-13 20:26:25 -08:00
Vishal Rana
01334bc7b2 enabled validator, updated docs, fixed #298, fixed #438, fixed #305
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-12-12 17:19:41 -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
133f7acf21 fixed #762
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-12-09 10:24:14 -08:00
Vishal Rana
1f0bae394a Gannett digital master allow html buffers (#765)
* Since some templating engines final result is a buffer, we've been casting them to strings, which is a bit unnecessary considering under the hood Echo supports this.

* Since some templating engines final result is a buffer, we've been casting them to strings, which is a bit unnecessary considering under the hood Echo supports this.

* Update context.go

* Update context_test.go

* Update context_test.go

* Utilize same design pattern for HTMLBlob as JSONBlob

* Streamlined a few more methods

* more  consistent

Signed-off-by: Vishal Rana <vr@labstack.com>
2016-12-06 18:57:06 -08:00
Vishal Rana
fd9508ca39 param alias, context#param
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-11-17 18:42:00 -08:00
Vishal Rana
8aa0e56e50 cleaner Context#Param
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-11-17 08:00:30 -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
7bd314557b fixed #694
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-10-27 07:35:41 -07: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
2fbaf3a363 minor refactor, #677
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-10-25 08:08:46 -07:00
Vishal Rana
51723e4c7c removed websocket api
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-10-20 18:25:40 -07:00
Vishal Rana
d72b8b8b64 fixed docs
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-10-20 09:10:10 -07:00
Vishal Rana
60ce130499 generic map Map
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-10-13 16:45:27 -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
0349e883f5 Moved logger to root
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-09-25 13:14:18 -07:00
Vishal Rana
7f60fcda63 WebSocket API
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-09-23 05:55:27 -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
Vishal Rana
2d772e02ca Updated deps, removed Context#Context()
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-09-08 14:54:07 -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