gin/binding
Ahmad Saeed Goda 28e57f58b1
fix(form): Set default value for form fields (#4047)
- Use specified default value in struct tags when binding a request input to struct for validation, even if sent empty, not only when not sent at all.
- Add string field to `TestMappingDefault` test case.
- Add test case for not sent form field to default to the value specified via code.
- Add test case for form field sent empty to default to the value specified via code.

Fixes: How to apply default value if empty value provided by client during model binding? #4042, #13042df, #a41721a
2024-09-06 13:21:19 +08:00
..
binding_msgpack_test.go ci(lint): enable testifylint linter (#4010) 2024-07-14 20:33:08 +08:00
binding_nomsgpack.go feat(binding): add BindPlain (#3904) 2024-05-13 11:11:56 +08:00
binding_test.go ci(lint): enable testifylint linter (#4010) 2024-07-14 20:33:08 +08:00
binding.go feat(binding): add BindPlain (#3904) 2024-05-13 11:11:56 +08:00
default_validator_benchmark_test.go refactor(slice): simplify SliceValidationError Error method (#3910) 2024-05-13 13:32:46 +08:00
default_validator_test.go test support go1.18 (#2990) 2022-03-21 09:43:17 +08:00
default_validator.go refactor(slice): simplify SliceValidationError Error method (#3910) 2024-05-13 13:32:46 +08:00
form_mapping_benchmark_test.go chore: update go.mod and remove space from copyright (#3158) 2022-05-28 10:42:28 +08:00
form_mapping_test.go fix(form): Set default value for form fields (#4047) 2024-09-06 13:21:19 +08:00
form_mapping.go fix(form): Set default value for form fields (#4047) 2024-09-06 13:21:19 +08:00
form.go chore: update go.mod and remove space from copyright (#3158) 2022-05-28 10:42:28 +08:00
header.go chore: update go.mod and remove space from copyright (#3158) 2022-05-28 10:42:28 +08:00
json_test.go Allow bind with a map[string]string (#2484) 2020-10-31 07:20:47 +08:00
json.go chore: support min go version 1.18 (#3511) 2023-03-01 10:03:48 +08:00
msgpack_test.go chore: support min go version 1.18 (#3511) 2023-03-01 10:03:48 +08:00
msgpack.go chore: support min go version 1.18 (#3511) 2023-03-01 10:03:48 +08:00
multipart_form_mapping_test.go ci(lint): enable testifylint linter (#4010) 2024-07-14 20:33:08 +08:00
multipart_form_mapping.go chore: update go.mod and remove space from copyright (#3158) 2022-05-28 10:42:28 +08:00
plain.go feat(binding): add BindPlain (#3904) 2024-05-13 11:11:56 +08:00
protobuf.go remove deprecated of package io/ioutil (#3395) 2022-11-17 22:35:55 +08:00
query.go Revert "fix(uri): query binding bug (#3236)" (#3899) 2024-03-22 10:01:27 +08:00
toml_test.go [GIN-001] - Add TOML bining for gin (#3081) 2022-05-28 08:34:43 +08:00
toml.go Adjust the position of some functions (#3385) 2023-01-17 14:23:54 +08:00
uri.go add v1.8.0 changelog (#3160) 2022-05-30 15:16:10 +08:00
validate_test.go ci(lint): enable testifylint linter (#4010) 2024-07-14 20:33:08 +08:00
xml_test.go Relocate binding body tests (#2086) 2019-10-10 16:58:31 +08:00
xml.go chore: update go.mod and remove space from copyright (#3158) 2022-05-28 10:42:28 +08:00
yaml_test.go Relocate binding body tests (#2086) 2019-10-10 16:58:31 +08:00
yaml.go chore(yaml): upgrade dependency to v3 version (#3456) 2023-01-02 12:40:48 +08:00