use nil-safe json renderer in ginresp
This commit is contained in:
parent
d396a12d68
commit
5de4f67344
@ -8,6 +8,7 @@ import (
|
||||
"fmt"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/rs/zerolog/log"
|
||||
json "gogs.mikescher.com/BlackForestBytes/goext/gojson"
|
||||
"gogs.mikescher.com/BlackForestBytes/goext/langext"
|
||||
"runtime/debug"
|
||||
"strings"
|
||||
@ -26,7 +27,7 @@ type jsonHTTPResponse struct {
|
||||
}
|
||||
|
||||
func (j jsonHTTPResponse) Write(g *gin.Context) {
|
||||
g.JSON(j.statusCode, j.data)
|
||||
g.Render(j.statusCode, json.GoJsonRender{Data: j.data, NilSafeSlices: true, NilSafeMaps: true})
|
||||
}
|
||||
|
||||
func (j jsonHTTPResponse) Statuscode() int {
|
||||
|
Loading…
Reference in New Issue
Block a user