v0.0.511
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 3m10s
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 3m10s
This commit is contained in:
@@ -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}
|
||||
}
|
||||
|
Reference in New Issue
Block a user