toimtoimtoim
130be07425
fix gzip not sending response code for no content responses (404, 301/302 redirects etc)
2023-07-16 20:35:09 +03:00
Ingo Oppermann
42f07ed880
gzip response only if it exceeds a minimal length ( #2267 )
...
* gzip response only if it exceeds a minimal length
If the response is too short, e.g. a few bytes, compressing the
response makes it even larger. The new parameter MinLength to the
GzipConfig struct allows to set a threshold (in bytes) as of which
response size the compression should be applied. If the response
is shorter, no compression will be applied.
2023-05-31 08:53:33 +03:00
zeek
3c4d3b3083
Replace "io/ioutil"
...
"io/ioutil" pakcage has been deprecated since Go 1.16.
2022-11-21 15:59:14 +02:00
Martti T
1d5f335f40
refactor assertions ( #2301 )
2022-10-12 21:47:21 +03:00
Nao Yonashiro
7bde9aea06
Fixed a problem that returned wrong content-encoding when the gzip compressed content was empty ( #1921 )
...
Fixed a problem that returned wrong content-encoding when the gzip compressed content was empty
2021-12-15 10:15:13 +02:00
Pablo Andres Fuente
ac54e132e4
Adding sync.Pool to Compress Middleware
...
Adding a sync.Pool for the *gzip.Writer reduces the allocations of the
Compress middleware in 50% and gives an increase on execution speed of
a 85%
This fix #1643
2020-11-07 03:52:35 +00:00
Hylke Visser
69bd47b35f
Fix flushing in Gzip middleware ( #1317 )
...
* Make Gzip response Writer also call Flush of underlying Writer
* Add unit test for chunked responses with Gzip
2019-04-16 15:52:06 -05: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
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
ferhat elmas
3641cbcdad
Fix formatting ( #1071 )
2018-02-25 13:42:58 -08:00
Evgeniy Kulikov
6da0483447
[FIX] We must close gzip.Reader, only if no error ( #1069 )
...
* [FIX] We must close gzip.Reader, only if no error
* review comments fix
2018-02-23 11:32:27 -08:00
Vishal Rana
4f3080c197
Bit of more cleanup
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2018-02-21 11:38:22 -08:00
Evgeniy Kulikov
f49d166e6f
[FIX] Cleanup code ( #1061 )
...
Code cleanup
2018-02-21 10:44:17 -08:00
ferhat elmas
7eec915044
Fix deferring body close in middleware/compress test ( #1063 )
2018-02-19 08:21:01 -08:00
Vishal Rana
cb9255e775
Using httptest
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-05-13 15:44:27 -07:00
Vishal Rana
29fd5831ff
Fixed test
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-02-22 15:57:12 -08:00
Vishal Rana
7140e8395a
Using _fixture for testing
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-02-14 14:11:10 -08:00
Edward Muller
6f90742dec
Set the Content-Encoding header earlier for Static
...
Static uses ServeContent, which looks to see if the Content-Encoding
header is set or not to determine if it should set the Content-Length.
If Content-Length is set by something it will be wrong after the gzip
compression happens and stricter routers (and tools like curl) will
have problems with the request.
Fixes #806
2017-02-13 19:12:58 -08:00
Vishal Rana
d9a6052c67
Closes #489 , Closes #781 , Updated docs
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-12-20 23:13:46 -08:00
Vishal Rana
562021ed2d
fixed #781
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-12-20 13:58:45 -08:00
Vishal Rana
5706940bc8
HTTPError#Message is now interface
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-12-10 22:05:41 -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
c654c422c4
More coverage and better response adapter for standard/response
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-06-06 22:27:36 -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
1c2d6341ba
Fixed #474
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-04-18 16:59:58 -07:00
Vishal Rana
ce80fc8ea4
Fixed middleware test cases
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-04-16 16:02:22 -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
b5d6c05101
Fixed #441 , #294
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-04-02 14:24:51 -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
b47abdb9ec
Fixed #424 , #427
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-03-20 08:14:55 -07:00
Vishal Rana
88f307bedd
Middleware and handler as closure
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-02-17 21:49:31 -08:00
Vishal Rana
c9a62e20b4
Middleware as structs
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-02-17 21:18:46 -08:00
Vishal Rana
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
Vishal Rana
f405794a7c
Now using sync.Pool
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-02-04 14:40:08 -08:00
Vishal Rana
688293b5ed
v2 is compiling now
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-01-28 23:46:11 -08:00
Vishal Rana
72459fe299
Step towards v2
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-12-03 17:23:53 -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
Tyler Bunnell
4f3335aac7
Add sync.Pool to gzip middleware
2015-09-11 16:23:57 -06:00
Chase Hutchins
50fb7e0050
More coverage for compress
middleware
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-06-26 21:24:14 -07:00
Chase Hutchins
356909c49e
Content type sniffing for compress
middleware
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-06-24 15:36:05 -07:00
Vishal Rana
ae721bd2b2
Bug in gzip, fixed #95 , #96 .
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-06-09 15:24:01 -07:00
Vishal Rana
1ac5425ec4
Fixed #95
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-06-09 09:16:52 -07:00
Vishal Rana
a9e49e2430
Total coverage for middleware
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-05-30 10:54:55 -07: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
6f728d428d
Added test from Echo.WebSocket()
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-05-21 22:48:34 -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
73fa05f826
Added panic recover middleware
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-05-17 22:54:29 -07:00
Vishal Rana
609879bf39
Refactored tests
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-05-16 12:49:01 -07:00
Vishal Rana
1ee3bc23e3
Added gzip middleware
...
Signed-off-by: Vishal Rana <vr@labstack.com>
2015-05-15 12:29:14 -07:00