* 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
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.
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%