MCPcopy
hub / github.com/zincsearch/zincsearch / GinRenderJSON

Function GinRenderJSON

pkg/zutils/gin.go:35–41  ·  view source on GitHub ↗
(c *gin.Context, code int, obj interface{})

Source from the content-addressed store, hash-verified

33}
34
35func GinRenderJSON(c *gin.Context, code int, obj interface{}) {
36 if requestsPrettyRendering(c) {
37 c.IndentedJSON(code, obj)
38 } else {
39 c.JSON(code, obj)
40 }
41}
42
43func requestsPrettyRendering(c *gin.Context) bool {
44 if p, ok := c.GetQuery("pretty"); ok && (strings.EqualFold(p, "true") || strings.EqualFold(p, "")) {

Callers 15

SetRoutesFunction · 0.92
SearchDSLFunction · 0.92
MultipleSearchFunction · 0.92
DeleteByQueryFunction · 0.92
CreateUpdateFunction · 0.92
UpdateFunction · 0.92
BulkFunction · 0.92
ESBulkFunction · 0.92
GetFunction · 0.92
AddOrRemoveESAliasFunction · 0.92
GetESAliasesFunction · 0.92
GetMappingFunction · 0.92

Calls 1

requestsPrettyRenderingFunction · 0.85

Tested by 1

TestGetRendererFunction · 0.68