8fb7b5be27
Closes #1353
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2019-06-27 10:52:17 -07:00
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
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
3d73323154
Use concurrency safe context by default. ( #1158 )
2019-02-12 10:56:26 -08:00
7867fce6ce
Changes related to #1199
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2019-01-14 10:56:17 -08:00
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
c8fd197fa8
Replace http constants with stdlib ones, i.e.: http.MethodGet instead of echo.GET ( #1205 )
2018-10-14 20:46:58 +05:30
059c099762
simplify tests ( #1206 )
2018-10-14 12:48:44 +05:30
f49d166e6f
[FIX] Cleanup code ( #1061 )
...
Code cleanup
2018-02-21 10:44:17 -08:00
ec048ea523
Fixed #1052 , dropped param alias feature
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2018-01-30 19:02:29 -08:00
cec7629194
Fixed test for content disposition
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2017-08-24 08:57:36 -07:00
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
f0e3f950cf
Tested and fixed bug with reused context (path parameters).
2017-03-30 12:05:24 +02:00
29fd5831ff
Fixed test
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2017-02-22 15:57:12 -08:00
20954afd66
fixed json, xml pretty print
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2016-12-09 11:13:55 -08:00
c5a3575d4c
updated migration guide
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2016-11-14 22:54:09 -08:00
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
36251e88e2
router changes
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2016-10-21 20:36:49 -07:00
8623669cbc
removed Context#P()
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2016-10-10 18:22:13 -07:00
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
2aec0353f5
First commit to v3, #665
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2016-09-22 22:56:00 -07:00
03efe4d61b
Closes #525 , closes #566 , closes #573 ( #653 )
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2016-09-09 15:30:46 -07:00
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
8a85626a71
Inline feature ( #637 )
2016-08-22 14:46:21 -07:00
85e2816cf3
Minor formatting/changes
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2016-08-22 08:30:46 -07:00
48c42e7b90
Fix Context#SetContext()/Context#Context()
2016-08-22 20:42:25 +09:00
4e98fa9664
Fixed #500
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2016-06-06 09:47:22 -07:00
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
09a2ce60a6
About context #500
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2016-06-05 13:47:59 -07:00
f0526349ff
Fixed #499
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2016-05-02 22:41:07 -07:00
190cf80d02
Fixed #432 , Fixed #167 .
...
Signed-off-by: Vishal Rana <vishal.rana@verizon.com >
2016-05-02 16:19:35 -07:00
cb752141f2
Add form binding
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2016-05-01 12:38:51 -07:00
be825e0229
Refactored variable names
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2016-04-24 10:22:15 -07:00
467cf05b41
Changes based on comments for #430
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2016-04-16 15:56:09 -07:00
b9aa2181b0
Trailing slash middleware with option to redirect
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2016-04-12 22:39:29 -07:00
609587e6eb
Fixed #463
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2016-04-11 16:49:20 -07:00
8b5772cf65
Proper header and MIME constants
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2016-04-06 07:29:47 -07:00
28ec39daaa
Context#StaticContent signature changed
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2016-03-27 21:03:35 -07:00
a2d757eddc
Closes #434
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2016-03-27 16:29:41 -07:00
a66162a3d2
Logging middleware fixes
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2016-03-21 17:27:14 -07:00
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
c4caeb8ffb
more godoc
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2016-03-19 15:47:20 -07:00
ac25928fd0
Closes #393
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2016-03-12 11:49:45 -08:00
09f3d3061f
Closes #314
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2016-03-11 07:53:54 -08:00
f4a5abc8b2
Removed Context#Socket
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2016-03-08 08:14:25 -08:00
a9c88cad63
Fixed #310
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2016-03-05 20:03:11 -08:00
c8725ae244
Context#Redirect
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2016-02-20 12:54:43 -08:00
51acf465fe
- Moved static file serving to a new handler package
...
- Middleware at route level
- Group middleware is a in closure now
Signed-off-by: Vishal Rana <vr@labstack.com >
2016-02-15 08:11:29 -08:00
6bb871fe3a
Dropped json and xml indent, added jsonblob.
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2016-02-10 16:51:43 -08:00
0731959a98
Object method to get real object
...
Signed-off-by: Vishal Rana <vr@labstack.com >
2016-02-08 16:48:03 -08:00