Lanco
4e7584175d
minor tweaks,optimize code ( #2788 )
2021-08-23 01:32:41 +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
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
bestgopher
9221381443
remove a unused type SecureJSONPrefix ( #2391 )
2020-05-24 10:58:28 +08:00
Kaushik Neelichetty
5f56109bcf
Use json marshall in context json to fix breaking new line issue. Fixes #2209 ( #2228 )
...
* ignore IntelliJ idea generated files
* update JSON renderer to use Marshall() instead of Encode(). Fix #2209
* Revert "ignore IntelliJ idea generated files"
This reverts commit e7bd017227
.
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: thinkerou <thinkerou@gmail.com>
2020-02-21 17:15:17 +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
George Gabolaev
01ca625b98
Fixed JSONP format (added semicolon) ( #2007 )
...
* Fixed JSONP format (added semicolon)
* render_test fix
2019-09-02 20:18:08 +08: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
Dmitry Kutakov
b056a34bdc
fix errcheck warnings ( #1739 )
2019-01-18 09:32:53 +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
田欧
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
田欧
6073a79ee0
not use protobuf on context but use it on render ( #1496 )
2018-08-19 17:39:58 +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
senhtry
8c24018290
Add Jsonp Support to Context ( #1333 )
2018-04-26 11:52:19 +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
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
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
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
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
1f56e50083
Using Render() instead of Write()
2015-06-04 05:25:21 +02:00
Manu Mtz-Almeida
a2105ce34c
Fast path for setting headers.
...
- No heap allocation
- No indirection
- CanonicalMIMEHeaderKey() is not called
2015-05-23 16:39:25 +02:00
Manu Mtz-Almeida
ffaf49da0e
Adds MIT license
2015-05-22 19:21:23 +02:00
Manu Mtz-Almeida
306da81aaf
Cosmetic changes in render
2015-05-22 04:44:29 +02:00
Manu Mtz-Almeida
947b53d4a2
New Render API
2015-05-18 15:45:24 +02:00
Manu Mtz-Almeida
a9dad532ae
Performance improvement in renders
2015-05-11 01:02:17 +02:00
Manu Mtz-Almeida
2d8f0a4801
Performance improvements when rendering
...
- Fast path for JSON, XML and plain text rendering
2015-05-07 12:44:52 +02:00