Ngalim Siregar
1f286f1199
Change msgpack codec from ugorji to vmihailenco
2019-07-05 22:14:33 +07:00
itcloudy
0cbf290302
use encode replace json marshal increase json encoder speed ( #1546 )
2019-05-22 07:48:50 +08:00
Dan Markham
094f9a9105
v1.4.0 + #1631 (remove go1.6/go1,7 support) ( #1851 )
...
* remove go1.6 support
* remove build tag
* remove todo
* remove go1.6 support: https://github.com/gin-gonic/gin/pull/1383/commits
* update readme
* remove go1.7 support
* fix embedmd error
* test
* revert it
* revert it
* remove context_17
* add pusher test
* v1.4.0 rc1
2019-05-07 18:32:32 +08:00
songjiayang
7b1081a73f
issue_1721: fix render writeHeaders to make it the same as http.Header.Set ( #1722 )
2019-02-22 14:20:24 +08:00
Dmitry Kutakov
b056a34bdc
fix errcheck warnings ( #1739 )
2019-01-18 09:32:53 +08:00
andriikushch
6ab50f944c
replace deprecated HeaderMap with Header() ( #1585 )
2018-10-12 07:31:31 +08:00
田欧
6db092f778
chore: add some annotations ( #1550 )
...
ref #1075 should all annotations and can close #1075 .
2018-09-15 15:21:54 +08:00
田欧
d510595aa5
chore: add some annotations ( #1544 )
...
ref: #1075
because I am not a native English, maybe have a bit problem.
2018-09-15 10:23:32 +08:00
Iskander (Alex) Sharipov
3f27866f80
simplify slice expressions: s[:] => s ( #1541 )
...
Found using https://go-critic.github.io/overview#unslice-ref
2018-09-12 21:21:26 +08:00
田欧
72db8acd99
add internal package which includes json package ( #1504 )
2018-08-30 19:04:03 +08:00
田欧
85f3e78abc
chore: remove else instead of return/continue ( #1502 )
...
As[ Effective Go](https://golang.org/doc/effective_go.html?#if ) about `if` said, remove else statement instead of return/continue statement.
2018-08-20 21:49:24 +08:00
Filip Figiel
c6110f970c
Add PureJSON renderer ( #694 )
...
Closes #693
2018-08-20 15:15:31 +08:00
田欧
b7bb9baa64
chore: add missing copyright and update if/else ( #1497 )
2018-08-19 22:52:43 +08:00
田欧
32b58e0fd2
render: update msgpack usage ( #1498 )
...
please see msgpack usage: https://github.com/ugorji/go/tree/master/codec#usage
2018-08-19 22:14:02 +08:00
田欧
6073a79ee0
not use protobuf on context but use it on render ( #1496 )
2018-08-19 17:39:58 +08:00
aljun
efdd3c8b81
Add support for Protobuf format response and unit test ( #1479 )
...
`Gin` now have the `protobufBinding` function to check the request format, but didn't have a protobuf response function like `c.YAML()`.
In our company [ByteDance](http://bytedance.com/ ), the largest internet company using golang in China, we use `gin` to transfer __Protobuf__ instead of __Json__, we have to write some internal library to make some wrappers to achieve that, and the code is not elegant. So we really want such a feature.
2018-08-19 10:45:56 +08:00
田欧
f45c928a15
chore: use http.Status* instead of hard code ( #1482 )
2018-08-14 09:51:56 +08:00
田欧
6159213462
unify test data ( #1417 )
...
mkdir a test data dir.
2018-08-12 23:38:31 +08:00
田欧
1ae32f3a2c
improve render code coverage ( #1474 )
...
all code coverage > 99%
2018-08-12 22:02:37 +08:00
grapeVine
e2b4cf6e2d
interface implement type check ( #1459 )
...
interface implement type check
2018-08-06 23:08:01 +08:00
Rex Lee(李俊)
85221af84c
add json ASCII string render ( #1358 )
...
add a json render that rendering json as ASCII string
2018-07-03 17:17:08 +08:00
Jean-Christophe Lebreton
bf7803815b
Serve easily dynamic files with `DataFromReader` context method ( #1304 )
...
* Add DataFromReader context method
* Replace fmt by strconv.FormatInt
* Add pull request link to README
2018-05-12 11:00:42 +08:00
senhtry
8c24018290
Add Jsonp Support to Context ( #1333 )
2018-04-26 11:52:19 +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
Weilin Shi
a816f9e9db
Remove redundant if err != nil check ( #1202 )
...
* Remove redundant if err != nil check
* Return e.EncodeToken instead of create a new variable
2017-12-21 11:00:17 +08:00
田欧
3b300929e8
Empty string check ( #1101 )
2017-09-29 00:22:35 +08:00
田欧
a8fa424ae5
update comment ( #1057 )
2017-08-16 11:55:50 +08:00
Bo-Yi Wu
ce670a6497
refactor(json): make jsonite optional with build tags ( #1026 )
...
* refactor(json): Restore gin support for app engine
Create new folder to support multiple json package.
restore gin support for app engine (disable jsonite through tags)
use jsoniter
$ go build -tags=jsoniter .
use default json
$ go build .
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* rename json file.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* docs(json): add build tags document.
* fix(docs): markdown format.
* fix(json): missing space.
2017-07-18 23:01:29 +02:00
Eason Lin
8436a9d829
fix(render): remove repeated static check. ( #998 )
2017-07-10 01:45:19 -05:00
Bo-Yi Wu
e23842ecab
fix json sort the map keys
...
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2017-07-08 18:19:09 +08:00
Bo-Yi Wu
12508320c2
feat: change json lib to jsoniter
...
A high-performance 100% compatible drop-in replacement of "encoding/json"
https://github.com/json-iterator/go
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2017-07-08 16:51:36 +08:00
Eason Lin
75ed286c60
feat: add SecureJSON func to prevent json hijacking
2017-07-08 01:21:30 +08:00
田欧
34e972e155
Separate type define ( #983 )
2017-07-06 07:59:27 -05:00
Thomas Boerger
e38c36ee0d
Made funMaps for the templates configurable and hot-reloadable
2017-06-30 21:22:40 +02:00
sope
35f5df63e6
add custom Delims support ( #860 )
...
* Revert "Merge pull request #753 from gin-gonic/bug"
This reverts commit 556287ff08
, reversing
changes made to 32cab500ec
.
* Revert "Merge pull request #744 from aviddiviner/logger-fix"
This reverts commit c3bfd69303
, reversing
changes made to 9177f01c28
.
* add custom Delims support
* add some test for Delims
* remove the empty line for import native package
* remove unuseful comments
2017-05-29 03:03:49 -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
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
Bo-Yi Wu
787bff85e5
fix testing.
...
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2016-12-11 10:14:23 +08:00
chriswhelix
97d310b55c
Honor normal gin write contract for context.JSON()
...
Gin normally silently swallows errors writing to the client; however in WriteJSON (and thus context.JSON), the ResponseWriter was being passed directly into the JSON encoder, which will return an error if there's an error writing to the stream. For instance, context.JSON would panic with errors like "write tcp XXX-> YYY: write: connection reset by peer" if the client disconnected before the response was complete. This change makes JSON.Render() treat write errors the same as IndentedJSON, Data, and other renderers.
2016-12-11 10:14:23 +08:00
Javier Provecho Fernandez
9e930b9bdd
lint code
2016-04-15 01:16:46 +02:00
Javier Provecho
007bd5124a
closes #514 , code from bobbo@b4f0b50
2016-04-14 23:47:49 +02:00
Manu Mtz.-Almeida
97cd894279
c.Redirect() allows 201 status code
2016-01-28 00:34:05 +01:00
Manu Mtz-Almeida
352868ef90
Add support for custom HTML and XML content-type
2015-06-13 04:43:23 +02:00
Manu Mtz-Almeida
a7c957af7d
Adds supports for custom JSON Content-type
2015-06-13 04:29:10 +02:00
Manu Mtz-Almeida
822b995687
c.JSON performance improvement
...
benchmark old ns/op new ns/op delta
BenchmarkOneRouteJSON 1143 1053 -7.87%
benchmark old allocs new allocs delta
BenchmarkOneRouteJSON 4 3 -25.00%
benchmark old bytes new bytes delta
BenchmarkOneRouteJSON 72 56 -22.22%
2015-06-04 13:08:29 +02:00
Manu Mtz-Almeida
56683d33b1
c.String() performance improvements
...
```
benchmark old ns/op new ns/op delta
BenchmarkOneRouteString 448 310 -30.80%
benchmark old allocs new allocs delta
BenchmarkOneRouteString 1 0 -100.00%
benchmark old bytes new bytes delta
BenchmarkOneRouteString 48 0 -100.00%
```
2015-06-04 12:53:42 +02:00
Manu Mtz-Almeida
1f56e50083
Using Render() instead of Write()
2015-06-04 05:25:21 +02:00
Manu Mtz-Almeida
a21cc8dd3d
Updates HTML render
2015-06-01 00:15:16 +02:00
Manu Mtz-Almeida
835f66fdc9
404 not found performance improvements
...
benchmark old ns/op new ns/op delta
Benchmark404 737 249 -66.21%
Benchmark404Many 2330 454 -80.52%
benchmark old allocs new allocs delta
Benchmark404 3 0 -100.00%
Benchmark404Many 10 0 -100.00%
benchmark old bytes new bytes delta
Benchmark404 115 68 -40.87%
Benchmark404Many 235 57 -75.74%
2015-05-30 14:45:13 +02:00