Behnam
f7d9f5142e
optimization: struct alignment ( #2636 )
...
(#2632 )
2024-05-30 22:50:01 +03:00
Martti T
3598f295f9
Change type definition blocks to single declarations. This helps copy/pasting Echo code in examples. ( #2606 )
2024-03-09 07:53:07 -08:00
Martti T
a842444e8f
Add SPDX licence comments to files. See https://spdx.dev/learn/handling-license-info/ ( #2604 )
2024-03-09 11:21:24 +02:00
Martti T
bc1e1904f1
Allow ResponseWriters to unwrap writers when flushing/hijacking ( #2595 )
...
* Allow ResponseWriters to unwrap writers when flushing/hijacking
2024-03-09 10:50:47 +02:00
imxyb
a7802ea523
add supprt for go1.20 http.rwUnwrapper
2023-04-06 13:37:41 +03:00
Rashad Ansari
0406abe066
Add the ability to change the status code using Response beforeFuncs
2020-12-06 18:31:15 +03:30
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
Alex Ungur
6d9e043284
Introduced Go module support as v4, removed obsolete CloseNotifier() mechanism
...
This reintroduces support for Go modules, as v4.
CloseNotifier() is removed as it has been obsoleted, see https://golang.org/doc/go1.11#net/http
It was already NOT working (not sending signals) as of 1.11 the functionality was gone, we merely
deleted the functions that exposed it. If anyone still relies on it they should migrate to using
`c.Request().Context().Done()` instead.
Closes #1268 , #1255
2019-01-30 16:11:42 +02:00
Vishal Rana
62d3587b6f
Minor performance fixes
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2018-03-14 14:03:59 -07:00
Vishal Rana
a028fd41fd
Fixed Response#Before()
...
Implemented Response#After()
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-12-24 11:01:53 -08:00
Vishal Rana
57bf87258f
Fixed #995
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-08-24 08:27:15 -07:00
Vishal Rana
ee85b46a05
Changed signature for response before func
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-06-29 10:59:21 -07:00
Vishal Rana
c7531df815
Fixed build
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-06-28 19:08:45 -07:00
Vishal Rana
f96c973a25
Fixed #176 , closed #831
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-06-28 17:01:48 -07:00
Vishal Rana
869cdcd19a
Dropped Response#Writer/SetWriter functions
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-12-21 18:56:35 -08: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
f27de9a804
Fixed logging
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-02-04 19:29:49 -08:00
Vishal Rana
2483d2a140
Reset Echo
in Response#reset()
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-12-02 08:07:22 -08:00
Vishal Rana
9650c39055
Bumped to v1.3
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-12-01 15:06:18 -08:00
Vishal Rana
4f996419e1
Fixed #255
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-11-20 19:39:35 -08:00
Vishal Rana
56954bc0b6
Closes #235 , Closes #203
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-11-12 20:23:14 -08:00
Chase Hutchins
56e44a759e
adding response.committed getter
2015-09-13 01:22:19 -07:00
Vishal Rana
1ae7ef40e0
Don't send http error if response already committed.
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-07-24 18:54:42 -07:00
Vishal Rana
ba42c8f32c
Clear echo.Response
if there is error while rendering.
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-07-07 17:34:59 -07:00
Vishal Rana
9b6c392829
Better tests for response.go
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-05-29 16:50:46 -07:00
Simon Green
87b24d3b7e
Response reset size
...
Set size to 0 when response reset
Prevents logged size accumulating with each request
2015-05-27 21:11:57 -06:00
Vishal Rana
bf85c56b08
Encapsulated fields and exposed public functions.
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-05-22 04:40:01 -07:00
Vishal Rana
13ac746093
Refactored Echo.HandlerFunc, added WebSocket support.
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-05-20 14:38:51 -07:00
Vishal Rana
cd1e235ccc
Wrapped Flush, Hijack and CloseNotify functions in response.
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-05-18 17:23:44 -07:00
Vishal Rana
5d636c1eb1
Updated docs
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-05-18 13:38:35 -07:00
Vishal Rana
73fa05f826
Added panic recover middleware
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-05-17 22:54:29 -07:00
Vishal Rana
d90395cf2b
Using int64 instead of uint64 for response size
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-05-15 15:24:47 -07:00
Vishal Rana
1ee3bc23e3
Added gzip middleware
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-05-15 12:29:14 -07:00
Vishal Rana
04cdefb2a6
Fixed #51
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-05-08 11:21:50 -07:00
Vishal Rana
064466bcde
Fixed a typo
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-04-19 19:54:17 -07:00
Vishal Rana
3eeea660fa
Dropped support for func(http.Handler) http.Handler middleware
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-04-19 16:00:23 -07:00
Vishal Rana
566ed78c1e
Fixed broken build
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-04-18 22:00:44 -07:00
Vishal Rana
f134ea3aea
Change middleware function signature.
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-04-18 21:46:00 -07:00
Vishal Rana
6633a1fca7
New renderer interface #21
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-04-09 14:59:31 -07:00
Vishal Rana
8f7c55e0ac
Refactored response
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-04-09 11:04:33 -07:00
Vishal Rana
a95d6668f3
#10
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-04-07 13:02:23 -07:00
Vishal Rana
d8aae6ea43
Changes for sub router #10
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-04-02 05:02:52 -07:00
Vishal Rana
c29ae7dd7d
Added coverage for middleware
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-03-29 20:44:55 -07:00
Vishal Rana
064a69d1dc
New name for repo
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-03-27 14:21:30 -07:00
Vishal Rana
e49e74aeac
Flexible handler and middleware
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-03-25 08:50:24 -07:00
Vishal Rana
05e8fee3de
Added response already committed logic
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-03-06 11:12:33 -08:00
Vishal Rana
91bbd38251
Bind and render functions
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-03-05 20:46:17 -08:00
Vishal Rana
7c9a0b6489
initial commit
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-03-01 09:45:13 -08:00