Commit Graph

159 Commits

Author SHA1 Message Date
Jo YoHan 3cb30679b5
feat(form): add array collection format in form binding (#3986)
* feat(form): add array collection format in form binding

* feat(form): add array collection format in form binding

* test(form): fix test code for array collection format in form binding
2024-08-24 14:16:30 +08:00
Matthieu MOREL 5f55c6a711
ci(lint): enable testifylint linter (#4010)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-07-14 20:33:08 +08:00
bruceNu1l 24d67647cb
feat(form): add custom string slice for form tag unmarshal (#3970) (#3971)
Co-authored-by: Bruce Lee <admin@ifocusad.com>
2024-05-23 10:16:11 +08:00
Name 3f5b0afa2a
refactor(slice): simplify SliceValidationError Error method (#3910)
* Simplify SliceValidationError Error method

* Replace fmt.Fprintf with b.WriteString

---------

Co-authored-by: huangzw <huangzw@hsmap.com>
Co-authored-by: 1911860538 <alxps1911@163.com>
2024-05-13 13:32:46 +08:00
guonaihong 6ca8ddb1ae
feat(binding): add BindPlain (#3904)
* add BindPlain

* fix ci/cd error
2024-05-13 11:11:56 +08:00
lgbgbl 8dd088927a
refactor(binding): use strings.Cut to replace strings.Index (#3522) 2024-05-08 06:28:15 +08:00
dkkb a18219566c
feat(binding): Support custom BindUnmarshaler for binding. (#3933) 2024-05-07 09:43:15 +08:00
ssfyn fd1faaded0
feat(binding): support override default binding implement (#3514) 2024-03-23 08:50:25 +08:00
Bo-Yi Wu d4e4136488
Revert "fix(uri): query binding bug (#3236)" (#3899)
This reverts commit 8790d08909.
2024-03-22 10:01:27 +08:00
illiafox 8790d08909
fix(uri): query binding bug (#3236)
* fix query mapping

* query binding test
2024-03-21 22:28:42 +08:00
Vincent Bernat 9c61295efe
chore(header): Add support for RFC 9512: application/yaml (#3851)
* fix(binding): support application/yaml

RFC 9512 defines application/yaml as the official YAML MIME type.
application/x-yaml is deprecated. In this commit, we ensure it is
recognized correctly in Content-Type.

* fix(render): use application/yaml when rendering YAML

As per RFC 9512, application/x-yaml is now deprecated and applications
should use application/yaml. This commit fix the Content-Type header
when rendering YAML.
2024-03-05 21:54:35 +08:00
Alonso Villegas 82bcd6d39b
fix(binding): dereference pointer to struct (#3199) 2024-02-07 19:44:11 +08:00
clearcode 3dc1cd6572
fix(binding): binding error while not upload file (#3819) (#3820)
Co-authored-by: zhangmj <zhangmj1@dustess.com>
2024-02-05 10:46:35 +08:00
Omkar P 44d0dd7092
fix: Add pointer support for url query params (#3659) (#3666)
The pointer support in url query params (using []*Struct for binding query params) was previously available in Gin, but was removed in commit 0d50ce8 since there wasn't a test case for such a scenario, and so the case block was removed as a redundant one.
2023-11-16 23:46:43 +08:00
thinkerou 1e1f0b1e76
chore: support min go version 1.18 (#3511)
* chore: min go version 1.18

* fix build tag error

* remove build tag

* fix word

* remove any.go

* replace interface{} instead of any
2023-03-01 10:03:48 +08:00
Heliner 1660995a04
Adjust the position of some functions (#3385)
Co-authored-by: fredhan <fredhan@futunn.com>
2023-01-17 14:23:54 +08:00
thinkerou c9b27249fb
chore(yaml): upgrade dependency to v3 version (#3456)
fixes https://github.com/gin-gonic/gin/issues/3451
fixes https://github.com/gin-gonic/gin/issues/3306
fixes https://github.com/gin-gonic/gin/issues/3362
fixes https://github.com/gin-gonic/gin/issues/2581
2023-01-02 12:40:48 +08:00
Qt 6150c488e7
remove deprecated of package io/ioutil (#3395) 2022-11-17 22:35:55 +08:00
Jesse 51aea73ba0
fix: modify interface check way (#3327) 2022-10-20 00:49:19 +08:00
hopehook 33ab0fc155
refactor(struct): Remove redundant type conversions (#3345) 2022-10-16 09:49:24 +08:00
John Bampton 24a1d2adb9
fix(typo): spelling `covert` -> `convert` (#3325) 2022-10-16 09:41:14 +08:00
thinkerou 38eb5acc6b
add v1.8.0 changelog (#3160) 2022-05-30 15:16:10 +08:00
thinkerou 4b68a5f12a
chore: update go.mod and remove space from copyright (#3158)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-28 10:42:28 +08:00
Valentine Oragbakosi ed03102ef0
[GIN-001] - Add TOML bining for gin (#3081)
Co-authored-by: GitstartHQ <gitstart@users.noreply.github.com>
2022-05-28 08:34:43 +08:00
Kacper Bąk c706ace929
fix: removed YODA conditions, removed blank identifier from `invalid_obj` (#3129)
* fix: removed YODA conditions, unnecessary binding.binding

* fix: remove BindingBody change
2022-04-23 18:01:03 +08:00
thinkerou 2bde107686
test support go1.18 (#2990) 2022-03-21 09:43:17 +08:00
jincheng9 8a0f95cc71
fix: typo (#2993) 2021-12-20 17:42:54 +08:00
edebernis 57ede9c95a
Export struct sliceValidateError to allow error casting and rename it as (#2777)
SliceValidationError

Co-authored-by: Emeric de Bernis <emeric.debernis@adevinta.com>
2021-11-21 21:45:03 +08:00
axiaoxin 1a2bc0e7cb
setted typo fix: There’s no such word as `setted`, `set` is set, set, setting (#2886) 2021-09-30 10:04:28 +08:00
Matthieu MOREL 71f7087097
golangci(lint) : more linters (#2870) 2021-09-21 15:22:21 +08:00
Tevic eab47b5423
fix: check obj type in protobufBinding (#2851)
* fix: check obj type in protobufBinding

* fix: UnitTest for invalid proto obj
2021-09-07 10:10:32 +08:00
Alexander Melentyev 527d950252
Delete unused arg (#2834) 2021-08-21 14:59:17 +08:00
Matthieu MOREL 435a76b735
chore(ci): update dependencies (#2827)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Matthieu MOREL <mmorel-35@users.noreply.github.com>
2021-08-19 15:46:31 +08:00
Helios 9d2883ef47
update the version of validator in the comment (#2780)
Co-authored-by: shangyilong <shangyilong@zuoyebang.com>
2021-07-06 16:36:32 +08:00
voidman 690aa2b1b9
feat(binding): support custom struct tag (#2720)
* feat(binding): support custom struct tag

Add function `binding.MapFormWithTag` (#2719)

* doc: add 'bind form-data with custom struct tag'

Add 'Bind form-data request with custom struct and custom tag' section (#2719)

* test(binding): add test for MapFromWithTag
2021-06-30 00:53:56 +08:00
ziheng e3ee01d185
improve sliceValidateError.Error performance using switch and strings.Builder (#2765)
fix missing nil pointer check

use simpler switch case

add missing tests

use for-loop instead of range

add benchmark test codes
2021-06-28 22:05:29 +08:00
tyltr 34ce2104ca
optimize code and reduce code cyclomatic complexity (#2737)
* optimize code and reduce code cyclomatic complexity

* optimize if-condtion

Co-authored-by: thinkerou <thinkerou@gmail.com>
2021-06-03 20:12:51 +08:00
heige 97a32b1de3
Optimize code adjust (#2700)
* setFormMap error of result

* adjust code for TrySet

* error export for type multipart.FileHeader

* code style adjust

* reflect code maping optimize

* Update form_mapping.go

Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: thinkerou <thinkerou@gmail.com>
2021-06-02 07:35:30 +08:00
iamhesir 0cbb30aa94
Update default validator's docs link (#2738)
The default validator has upgraded from v8 to v10, but its docs link didn't.
2021-05-26 18:46:13 +08:00
y-yagi 168edcad80
Check multipart file header size on test (#2716)
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: thinkerou <thinkerou@gmail.com>
2021-05-23 11:44:41 +08:00
Qt 215c9ce231
use errors.New to replace fmt.Errorf will much better (#2707) 2021-04-28 18:39:09 +08:00
thinkerou ed6f85c478
build: convert to go:build directives (#2664) 2021-03-27 09:09:44 +08:00
wuhuizuo 4bfae4c8c8
Support binding for slice/array obj [Rewrite] (#2302)
Co-authored-by: thinkerou <thinkerou@gmail.com>
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2021-01-03 21:43:34 +08:00
Alessandro (Ale) Segala 65ed60ed13
Allow bind with a map[string]string (#2484)
Co-authored-by: thinkerou <thinkerou@gmail.com>
2020-10-31 07:20:47 +08:00
lantw44 30b5f7e2d7
binding: avoid 2038 problem on 32-bit architectures (#2450)
Function setTimeField calls strconv.ParseInt with bit size 0 when
parsing Unix time, which means it is equivalent to specifying 32 on
32-bit architectures. This causes the function to suffer from the year
2038 problem. To fix it and keep the behavior the same on both 32-bit
and 64-bit architectures, explicitly specify bit size 64.

Co-authored-by: thinkerou <thinkerou@gmail.com>
2020-08-08 17:31:08 +08:00
John Bampton cf8b583db4
Fix spelling (#2451) 2020-08-04 07:04:06 +08:00
Andy Pan 982daeb1ec Use zero-copy approach to convert types between string and byte… (#2206)
* Use zero-copy approach to convert types between string and byte slice

* Rename argument to a eligible one

Benchmark:

BenchmarkBytesConvBytesToStrRaw-4   	21003800	        70.9 ns/op	      96 B/op	       1 allocs/op
BenchmarkBytesConvBytesToStr-4      	1000000000	         0.333 ns/op	       0 B/op	       0 allocs/op
BenchmarkBytesConvStrToBytesRaw-4   	18478059	        59.3 ns/op	      96 B/op	       1 allocs/op
BenchmarkBytesConvStrToBytes-4      	1000000000	         0.373 ns/op	       0 B/op	       0 allocs/op


Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2020-01-18 00:32:50 +08:00
Antoine GIRARD fd8a65b252 Add build tag nomsgpack (#1852)
* add build tag nomsgpack

* Update copyright

* Update copyright
2020-01-07 11:31:10 +08:00
thinkerou d5f12ac6d7
use http method constant (#2155)
* use http method constant

* fix typo
2019-11-29 07:50:49 +08:00
Ngalim Siregar 231ff00d1f Refactor redirect request in gin.go (#1970)
* Refactor redirect request in gin.go

* Update http status code
2019-11-26 08:19:30 +08:00