v0.0.511
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 3m10s

This commit is contained in:
Mike Schwörer 2024-09-15 18:22:07 +02:00
parent a1668b6e5a
commit d7fbef37db
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
2 changed files with 14 additions and 6 deletions

View File

@ -7,10 +7,11 @@ import (
)
type jsonHTTPResponse struct {
statusCode int
data any
headers []headerval
cookies []cookieval
statusCode int
data any
headers []headerval
cookies []cookieval
filterOverride *string
}
func (j jsonHTTPResponse) jsonRenderer(g *gin.Context) json.GoJsonRender {
@ -18,6 +19,9 @@ func (j jsonHTTPResponse) jsonRenderer(g *gin.Context) json.GoJsonRender {
if jsonfilter := g.GetString(jsonFilterKey); jsonfilter != "" {
f = &jsonfilter
}
if j.filterOverride != nil {
f = j.filterOverride
}
return json.GoJsonRender{Data: j.data, NilSafeSlices: true, NilSafeMaps: true, Filter: f}
}
@ -68,3 +72,7 @@ func (j jsonHTTPResponse) Headers() []string {
func JSON(sc int, data any) HTTPResponse {
return &jsonHTTPResponse{statusCode: sc, data: data}
}
func JSONWithFilter(sc int, data any, f string) HTTPResponse {
return &jsonHTTPResponse{statusCode: sc, data: data, filterOverride: &f}
}

View File

@ -1,5 +1,5 @@
package goext
const GoextVersion = "0.0.510"
const GoextVersion = "0.0.511"
const GoextVersionTimestamp = "2024-09-13T18:06:49+0200"
const GoextVersionTimestamp = "2024-09-15T18:22:07+0200"