Commit Graph

150 Commits

Author SHA1 Message Date
Salim Afiune 0c50dddd37 Merge branch 'master' into afiune/add-StringHTML 2017-08-01 14:01:30 -04:00
Eason Lin df37e74fa1 doc(context): more clearer bind doc when input is not valid (#1049) 2017-08-01 12:49:28 +08:00
Salim Afiune 820b43916a Adds a new StringHTML Render method
This new `StringHTML()` method will allow users to render HTML without
the need of an actual file on disk.

Example:
```
r.GET("/saludos", func(c *gin.Context) {
	c.StringHTML(200, "<html><body>Hola amigo!</body></html>")
})
```
Signed-off-by: Salim Afiune <salim@afiunemaya.com.mx>
2017-07-31 10:03:06 -04:00
Eason Lin 7fafb3f4a1 doc(context): add status func comment. (#1042) 2017-07-28 08:50:58 +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
田欧 7180f2ba62 not use tmp var (#1032) 2017-07-17 22:39:39 -05:00
Eason Lin 93b3a0d7ec feat(context): add SaveUploadedFile func. (#1022)
* feat(context): add SaveUploadedFile func.

* feat(context): update multiple upload examples.

* style(example): fix gofmt

* fix(example): add missing return
2017-07-15 22:42:08 -05:00
田欧 aa6d2d29f8 refactor(doc): use space not tab (#1006) 2017-07-11 10:28:08 -05:00
Eason Lin 75ed286c60 feat: add SecureJSON func to prevent json hijacking 2017-07-08 01:21:30 +08:00
田欧 e0fd6238d3 use comma ok and use single line (#984) 2017-07-06 09:49:54 -05:00
田欧 b985857899 update func comment (#981) 2017-07-05 20:28:16 -05:00
Javier Provecho Fernandez 42a34cdc35 docs(context): document keys, errors, and accepted, close #488 2017-07-05 16:55:59 +02:00
Javier Provecho Fernandez d875f07409 Merge branch 'master' into develop 2017-07-02 14:23:55 +02:00
Javier Provecho Fernandez 68aa2c38da fix(context): switch deprecated bindwith for mustbindwith 2017-06-28 00:46:35 +02:00
Javier Provecho Fernandez 1a9cba2cc7 Merge pull request #855 from gin-gonic/feat/662
feat(context): add idiomatic binding functions for clear err managment
2017-06-28 00:16:34 +02:00
Javier Provecho Fernandez 9a79e3f144 fix(import): switch sse import from gopkg to github 2017-06-27 23:17:02 +02:00
Bo-Yi Wu 1e1e4fc867 Add Makefile to check the following thing (#947)
* Add Makefile to check the following thing.

* vet check
* fmt check
* embedmd check
* misspell check

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* remove unused variable.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2017-06-12 21:50:42 -05:00
collinmsn 3f95933c3d Add method to return main handler (#930)
Fix #928 Method to get main handler is desired
2017-06-02 03:00:55 -05:00
Javier Provecho Fernandez 5eea51b6c9 feat(context): add cast helpers to c.Keys (#856)
* feat(context): add cast helpers to c.Keys

* Add tests for cast helpers to c.Keys
2017-06-01 20:00:04 -05:00
Ammar Bandukwala 781cbd19f0
panic if err is nil on c.Error
A panic here provides a more informative stack trace than the panic which would otherwise occur while errors are being collected.
2017-05-09 22:30:56 -05:00
Rahul Datta Roy d4a53101c3 Fix minor type in context.go (#900)
* Fix minor type in context.go

* More spelling fixes in context.go
2017-05-04 09:22:48 +08:00
Bo-Yi Wu 41316b9ca9 feat: add GetRawData func. (#857)
* feat: add GetRawData func.

* update return style

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2017-03-31 08:45:56 +08:00
Javier Provecho 73e5fcd855 feat(context): add idiomatic binding functions for clear err managment 2017-03-29 14:32:12 +00:00
Bo-Yi Wu ad2dacedd6 feat: Support get value from request header. (#839) 2017-03-24 20:43:23 +08:00
pjgg 6ce1e86a27 chore(errorHandler):new abortWithStatus method with Json body (#800) 2017-02-14 09:11:01 +08:00
mbesancon 2d8477fc42 Fixed typos in Context (#797)
Simple english typos in the Copy() method
2017-02-01 22:47:50 +08:00
Javier Provecho Fernandez 963acc4b0c Fix #198 (#781)
* Add new function to Render interface for writing content type only

* Add support for the new function in Render interface for writing content-type only

* Fix unhandled merge conflict in context_test.go

* Update vendor.json
2017-01-09 16:24:48 +01:00
tsirolnik c115074d77 Use X-Forwarded-For before X-Real-Ip
Nginx uses X-Real-Ip with its IP instead of the client's IP. Therefore, we should use X-Forwarded-For *before* X-Real-Ip
2017-01-03 23:43:05 +08:00
David Irvine ebe3580daf Add convenience method to check if websockets required (#779)
* Add convenience method to check if websockets required

* Add tests

* Fix up tests for develop branch
2017-01-02 16:05:30 +08:00
Bo-Yi Wu 5cc3d5955f Support upload single or multiple files.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2016-12-24 12:25:01 +08:00
Javier Provecho Fernandez 2cab17ba50 Merge pull request #701 from maxatome/patch-1
Context.Get() does not need to test whether Keys is nil or not
2016-12-06 20:39:01 +01:00
Bo-Yi Wu 764e138e32 Merge pull request #755 from gin-gonic/755-app-engine-client-ip
Fix #723
2016-12-06 08:14:11 -06:00
Javier Provecho Fernandez 7e58c80a7c Fix #723 2016-12-06 14:28:01 +01:00
Javier Provecho Fernandez 273e43a27a Merge pull request #724 from chiffa-org/redundant_context_import
Move golang.org/x/net/context.Context interface implementation check to tests
2016-12-05 10:55:06 +01:00
Bo-Yi Wu 6f474cb42d Merge pull request #570 from andreynering/array
Implement QueryArray and PostFormArray methods
2016-12-03 08:12:19 +08:00
Vyacheslav Dubinin ceb250ba20 Move golang.org/x/net/context.Context interface implementation check to tests 2016-10-19 17:13:38 +03:00
Maxime Soulé bf8da4a08a Context.Get() does not need to test whether Keys is nil or not 2016-09-09 11:37:22 +02:00
Javier Provecho Fernandez 9e930b9bdd lint code 2016-04-15 01:16:46 +02:00
Javier Provecho Fernandez 4df51ad4f8 Merge pull request #587 from roylou/develop
Write header immediately in AbortWithStatus(), close #585
2016-04-15 00:36:29 +02:00
Javier Provecho 007bd5124a closes #514, code from bobbo@b4f0b50 2016-04-14 23:47:49 +02:00
Roy Lou 4c4444b160 Write header immediately in AbortWithStatus()
Otherwise, caller needs to invoke WriteHeaderNow himself after
AbortWithStatus(), which is error-prone.

Also modified ErrorLoggerT() such that it always writes log to response
body. Otherwise calling AbortWithStatus() will fail to write body because
c.Writer.Written() is set true by WriteHeaderNow().
2016-04-15 00:02:29 +08:00
Kamron Batman 70c104e16c [Cleanup] Typo in context.go
Fixes typo from 'If Parses' to 'It parses'
2016-04-01 16:29:28 -07:00
Andrey Nering f3ff8f827c Refactor GetQuery and GetPostForm 2016-03-29 21:54:21 -03:00
Andrey Nering 9366e33ffc Implement QueryArray and PostArray methods 2016-03-29 21:48:50 -03:00
Michael Puncel 7171b967a3 s/currect/current 2016-03-07 21:56:46 -08:00
Michael Puncel 13565e1bf5 fix typo in godoc for func (*Context) HandlerName 2016-03-07 20:54:10 -08:00
Manu Mtz.-Almeida 44978ff780 Improves Context documentation
Query(), GetQuery(), PostForm(), GetPostForm()...
2016-01-29 02:42:19 +01:00
Manu Mtz.-Almeida afc499f306 Adds GetQuery() and GetPostForm() APIs 2016-01-29 02:07:44 +01:00
Manu Mtz.-Almeida d64a1fb91c Cosmetic changes 2016-01-28 00:35:09 +01:00
Manu Mtz.-Almeida 61fae4997d Improves documentation 2016-01-26 22:40:29 +01:00