1
0
mirror of https://github.com/labstack/echo.git synced 2024-12-02 08:51:42 +02:00
Commit Graph

21 Commits

Author SHA1 Message Date
J. David Lowe
8d7f05e533 round-trip paramValues without exploding (#1463) 2020-01-23 18:32:17 -08:00
Eugene
399da56370 Improve bind performance (#1469)
* Improve bind performance

By some slight optimisations and lesser reflect usage now binding has significantly better performance:

name                    old time/op    new time/op    delta
BindbindData-8            21.2µs ± 2%    13.5µs ± 2%  -36.66%  (p=0.000 n=16+18)
BindbindDataWithTags-8    22.1µs ± 1%    16.4µs ± 2%  -26.03%  (p=0.000 n=20+20)

name                    old alloc/op   new alloc/op   delta
BindbindData-8            2.40kB ± 0%    1.33kB ± 0%  -44.64%  (p=0.000 n=20+20)
BindbindDataWithTags-8    2.31kB ± 0%    1.54kB ± 0%  -33.19%  (p=0.000 n=20+20)

name                    old allocs/op  new allocs/op  delta
BindbindData-8               297 ± 0%       122 ± 0%  -58.92%  (p=0.000 n=20+20)
BindbindDataWithTags-8       267 ± 0%       125 ± 0%  -53.18%  (p=0.000 n=20+20)

* Remove creation of new value in unmarshalFieldNonPtr
2020-01-08 13:40:52 -08:00
Bob Hall
b129098169 dont return 400 for empty bodies (#1410)
* dont return 400 for empty bodies

* remove test for missing contentlength 0
2019-09-30 10:56:32 -07:00
kolaente
858270f6f5 Added feature to map url params to a struct with the default binder (#1165)
* Added feature to map url params to a struct with the default binder

* Added test for mix of POST data and bound params

* Renamed variables

* Added error check

* Removed unneded fix
2019-06-21 06:12:55 -07:00
Garrett D'Amore
c824b8ddc3 Add support for encoding.TextUnmarshaler in bind. (#1314) 2019-06-09 09:39:54 -07: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
Thuc Le
f7470482fe Support internal error when Bind() data #888 (#1164) 2018-09-28 10:41:13 -07:00
Brandon Hansen
6007218835 case sensitive matching prioritized 2018-07-03 13:04:50 -07:00
Brandon Hansen
01cfe83efe Enable case insensitive query param matching
Unmarshalling body params with json.Unmarshal supports case-insensitive
matching against struct tags.  Matching query params case insensitive
provides a more sane and consistent experience for API consumers.

The original url.Values keys remain case sensitive.
2018-07-03 13:04:50 -07:00
AnuchitO
d36ff72961 Add field name in Error message when Binding type mismatch
Old error message
`
Unmarshal type error: expected=int, got=string, offset=47
`
New error message
`
Unmarshal type error: expected=int, got=string, field=age, offset=47
`
Make it easy to fix for client.
2018-05-01 06:51:22 -07:00
Evgeniy Kulikov
f49d166e6f [FIX] Cleanup code (#1061)
Code cleanup
2018-02-21 10:44:17 -08:00
Vishal Rana
70c18060bd Fixed #988, Closed #989
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-08-14 21:48:19 -07:00
Vishal Rana
b42edd791f Closes #980
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-08-02 23:16:11 -07:00
Guilherme Oenning
f8c3008787 Request: New bind property for route parameters (#973)
* bind route params

* rename to bindPathData
2017-07-25 07:22:19 -07:00
Christopher Probst
f3f3e99ba3 Add pointer binding of proper types to DefaultBinder (#915) 2017-04-28 11:07:20 -07:00
Vishal Rana
b218599906 Fixed #864 (#865)
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-02-28 12:04:29 -08:00
Vishal Rana
29fd5831ff Fixed test
Signed-off-by: Vishal Rana <vr@labstack.com>
2017-02-22 15:57:12 -08:00
Jonathan Hall
ed7353cf60 Fix binding of untagged struct fields (#812)
* Add failing test

A BindUnmarshaler struct with no tag is not decoded properly.

* Fix binding of untagged structs
2017-01-15 23:13:46 -08:00
Jonathan Hall
9cdc439f34 Support BindUnmarshaler for basic types (#786)
* Add a failing test for #784

* Change ordering of unmarshaler, to handle BindUnmarshalers first

* Add test for arrays of BindUnmarshalers
2016-12-23 10:01:42 -08:00
Vishal Rana
c848119eef fixed #763
Signed-off-by: Vishal Rana <vr@labstack.com>
2016-12-15 11:08:56 -08:00