Commit Graph

32 Commits

Author SHA1 Message Date
Boyi Wu c16bfa7949 update for supporting file binding (#1264)
update for supporting multipart form and file binding 

example:
```
type PhoptUploadForm struct {
	imgData    *multipart.FileHeader `form:"img_data" binding:"required"`
	ProjectID   string `form:"project_id" binding:"required"`
	Description string `form:"description binding:"required"`
}
```


ref: https://github.com/gin-gonic/gin/issues/1263
2019-03-18 10:16:34 +08:00
Dmitry Kutakov 483f828bce add support arrays on mapping (#1797)
* add support arrays on mapping

* not allow default value on array mapping
2019-03-14 13:34:56 +08:00
Dmitry Kutakov 805b2d4904 add support time.Duration on mapping (#1794) 2019-03-04 11:37:46 +08:00
Dmitry Kutakov 0d50ce8597 refactor(form_mapping.go): mapping ptr, struct and map (#1749)
* refactor(form_mapping.go): mapping ptr, struct and map

* fix #1672 correct work with ptr - not create value if field is not set
* avoid allocations on strings.Split() - change to strings.Index()
* fix #610 tag value "-" is mean ignoring field
* struct fields mapped like json.Unmarshal
* map fields mapped like json.Unmarshal

* fix after @thinkerou review
2019-03-03 14:39:43 +08:00
André Bazaglia 48f6c6137c allow ignoring field on form mapping (#1733) 2019-02-22 12:23:52 +08:00
Dmitry Kutakov b056a34bdc fix errcheck warnings (#1739) 2019-01-18 09:32:53 +08:00
Dmitry Kutakov 49e4b0c60c fix mapping inner structs with correct tag (#1718) 2018-12-28 09:57:09 +08:00
thinkerou f463d847c2
chore: fix test fail (#1669)
* chore: fix test fail

* fix binduri test fail
2018-12-05 05:58:35 +08:00
mllu 64457fbca7 handle nil body for JSON binding (#1638) 2018-11-22 09:55:51 +08:00
thinkerou 521d06c81d support bind uri param (#1612)
* support bind uri (1)

* uri binding successful run

* fix vet warning: github.com/gin-gonic/gin/internal.Param composite literal uses unkeyed fields

* fix code style

* update function name

* fix test function signature

* add test for CanSet

* update readme and add test case

* remove internal.Params

* add coverage

* fix warning
2018-11-22 09:29:48 +08:00
Gordon Tyler 8cb390f8fe Yaml binding (#1618)
* Add YAML binding for application/x-yaml.

* Add YAML binding methods to Context.

* Review fixes.

* Revert accidentally removed import.
2018-11-06 09:49:45 +08:00
田欧 6159213462 unify test data (#1417)
mkdir a test data dir.
2018-08-12 23:38:31 +08:00
chainhelen 5636afe02d fix bug, return err when failed binding bool (#1350)
* fix bug, return err when failed binding bool

* add test, return err when failed binding bool
2018-05-11 22:40:33 +08:00
田欧 bd4f73af67 support struct pointer (#1342)
* support struct pointer

* add readme
2018-05-01 14:24:18 +08:00
Alexander Lokhman 2282be059b Add support of pointers in form binding (#1336)
* Add support of pointers in form binding

* Add tests for pointer form binding
2018-04-26 22:09:34 +08:00
田欧 41f951e0cd support default value for form (#1138)
* support default value for form

* fix bug for nil interface

* use SplitN and optimization code

* add test case

* add test cases for form(own default value)

* fix invalid code

* fix code indent

* assert order
2018-04-25 16:24:03 +08:00
田欧 dfe37ea6f1 unify assert.Equal usage (#1327)
* unify assert.Equal usage

* fix typo
2018-04-20 10:27:44 +08:00
田欧 783c7ee9c1 Add some test cases and run test cases on binding/render dir (#1168)
* Travis run test cases on binding and render dir and add some test cases for binding and render
2018-01-26 11:46:11 +08:00
Eason Lin c19aa0598b feat(context): add BindQuery func (#1029)
* feat(context): add BindQuery func, only parse/bind the query string params.

* docs(readme): add BindQuery section.

* docs(readme): fix import.

* docs(readme): separate import
2017-07-19 09:50:05 +02:00
田欧 d922143bc5 lint code for import (#939) 2017-06-11 21:40:15 -05:00
Harindu Perera 5be2123c1a Added support for MessagePack binding and rendering (#808)
Added deps to vendor.json and fixed rendering bug
2017-02-23 22:08:37 +08:00
Javier Provecho Fernandez a6ce7dd84a Merge branch 'bind_test' of https://github.com/honteng/gin into honteng-bind_test 2016-02-24 19:20:20 +01:00
Naoki Takano 66c4b81579 Added exits check tests for binding 2015-12-30 22:49:38 -08:00
Javier Provecho Fernandez e5339a3f4d Merge branch 'new-binding-validator' of https://github.com/zhing/gin into zhing-new-binding-validator
Conflicts:
	binding/binding.go
	binding/binding_test.go
2015-10-02 10:42:58 +02:00
zhing 9d644d22e0 add protobuf binding for gin 2015-07-12 17:42:39 +08:00
Manu Mtz-Almeida 4194adce4c Adds additional bindings for multipart and form 2015-07-03 04:20:00 +02:00
Manu Mtz-Almeida fecde9fed6 Refactors binding validation 2015-05-31 16:18:50 +02:00
Manu Mtz-Almeida ec1ce34d32 Merge branch 'multipart-form-data-fix' of https://github.com/konjoot/gin
- the merge was manually modified before committing.
2015-05-26 16:47:10 +02:00
Maksimov Sergey e46f4980b9 Restored support of multipart/form-data 2015-05-26 15:21:35 +03:00
Manu Mtz-Almeida 208e1f5569 Merge branch 'master' of https://github.com/remerge/gin
Conflicts:
	binding/binding.go
2015-05-24 03:33:21 +02:00
Manu Mtz-Almeida f414648384 - More unit tests
- Improves HTML debug render
- InputHolder removed
- More debug logs
2015-05-05 15:06:38 +02:00
Manu Mtz-Almeida 0a192fb0fa Tons of unit tests 2015-04-09 12:15:02 +02:00