Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace qjson with gjson 74055 #90

Merged
merged 4 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
752 changes: 388 additions & 364 deletions README.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions api_testcase.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type Case struct {
ResponseData any `json:"response"`
ContinueOnFailure bool `json:"continue_on_failure"`
Store map[string]any `json:"store"` // init datastore before testrun
StoreResponse map[string]string `json:"store_response_qjson"` // store qjson parsed response in datastore
StoreResponse map[string]string `json:"store_response_gjson"` // store gjson parsed response in datastore

Timeout int `json:"timeout_ms"`
WaitBefore *int `json:"wait_before_ms"`
Expand Down Expand Up @@ -284,10 +284,10 @@ func (testCase Case) executeRequest(counter int) (responsesMatch compare.Compare
}

// Store in custom store
err = testCase.dataStore.SetWithQjson(apiRespJsonString, testCase.StoreResponse)
err = testCase.dataStore.SetWithGjson(apiRespJsonString, testCase.StoreResponse)
if err != nil {
testCase.LogReq(req)
err = fmt.Errorf("error store response with qjson: %s", err)
err = fmt.Errorf("error store response with gjson: %s", err)
return responsesMatch, req, apiResp, err
}

Expand Down
4 changes: 2 additions & 2 deletions api_testcase_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func init() {
rand.Seed(time.Now().UnixNano())

}
func TestQjson(t *testing.T) {
func TestGjson(t *testing.T) {
jsolo := `{"body":[{"_session":{"token":"ac554a02-3ef0-42da-8ffb-603d73de95f9"},"event":{"_id":46,"global_object_id":"1@ebe5e467-4da9-4cff-81b6-cee9b1385b7c","object_id":1,"object_version":1,"objecttype":"main","pollable":true,"schema":"USER","session_self":true,"timestamp":"2019-03-13T10:41:05+01:00","type":"OBJECT_INSERT"},"user":{"_generated_displayname":"Root","_id":1}},{"_session":{"token":"ac554a02-3ef0-42da-8ffb-603d73de95f9"},"event":{"_id":47,"global_object_id":"2@ebe5e467-4da9-4cff-81b6-cee9b1385b7c","object_id":2,"object_version":1,"objecttype":"main","pollable":true,"schema":"USER","session_self":true,"timestamp":"2019-03-13T10:41:05+01:00","type":"OBJECT_INSERT"},"user":{"_generated_displayname":"Root","_id":1}},{"_session":{"token":"ac554a02-3ef0-42da-8ffb-603d73de95f9"},"event":{"_id":48,"global_object_id":"3@ebe5e467-4da9-4cff-81b6-cee9b1385b7c","object_id":3,"object_version":1,"objecttype":"main","pollable":true,"schema":"USER","session_self":true,"timestamp":"2019-03-13T10:41:06+01:00","type":"OBJECT_INSERT"},"user":{"_generated_displayname":"Root","_id":1}},{"_session":{"token":"ac554a02-3ef0-42da-8ffb-603d73de95f9"},"event":{"_id":49,"global_object_id":"4@ebe5e467-4da9-4cff-81b6-cee9b1385b7c","object_id":4,"object_version":1,"objecttype":"main","pollable":true,"schema":"USER","session_self":true,"timestamp":"2019-03-13T10:41:06+01:00","type":"OBJECT_INSERT"},"user":{"_generated_displayname":"Root","_id":1}},{"event":{"_id":50,"global_object_id":"1@ebe5e467-4da9-4cff-81b6-cee9b1385b7c","object_id":1,"object_version":1,"objecttype":"main","pollable":true,"schema":"USER","timestamp":"2019-03-13T10:41:06+01:00","type":"OBJECT_INDEX"}},{"event":{"_id":51,"global_object_id":"2@ebe5e467-4da9-4cff-81b6-cee9b1385b7c","object_id":2,"object_version":1,"objecttype":"main","pollable":true,"schema":"USER","timestamp":"2019-03-13T10:41:06+01:00","type":"OBJECT_INDEX"}},{"_session":{"token":"ac554a02-3ef0-42da-8ffb-603d73de95f9"},"event":{"_id":52,"global_object_id":"5@ebe5e467-4da9-4cff-81b6-cee9b1385b7c","object_id":5,"object_version":1,"objecttype":"main","pollable":true,"schema":"USER","session_self":true,"timestamp":"2019-03-13T10:41:06+01:00","type":"OBJECT_INSERT"},"user":{"_generated_displayname":"Root","_id":1}},{"_session":{"token":"ac554a02-3ef0-42da-8ffb-603d73de95f9"},"event":{"_id":53,"global_object_id":"6@ebe5e467-4da9-4cff-81b6-cee9b1385b7c","object_id":6,"object_version":1,"objecttype":"main","pollable":true,"schema":"USER","session_self":true,"timestamp":"2019-03-13T10:41:06+01:00","type":"OBJECT_INSERT"},"user":{"_generated_displayname":"Root","_id":1}},{"_session":{"token":"ac554a02-3ef0-42da-8ffb-603d73de95f9"},"event":{"_id":54,"global_object_id":"7@ebe5e467-4da9-4cff-81b6-cee9b1385b7c","object_id":7,"object_version":1,"objecttype":"main","pollable":true,"schema":"USER","session_self":true,"timestamp":"2019-03-13T10:41:06+01:00","type":"OBJECT_INSERT"},"user":{"_generated_displayname":"Root","_id":1}},{"_session":{"token":"ac554a02-3ef0-42da-8ffb-603d73de95f9"},"event":{"_id":55,"global_object_id":"8@ebe5e467-4da9-4cff-81b6-cee9b1385b7c","object_id":8,"object_version":1,"objecttype":"main","pollable":true,"schema":"USER","session_self":true,"timestamp":"2019-03-13T10:41:07+01:00","type":"OBJECT_INSERT"},"user":{"_generated_displayname":"Root","_id":1}},{"_session":{"token":"ac554a02-3ef0-42da-8ffb-603d73de95f9"},"event":{"_id":56,"global_object_id":"9@ebe5e467-4da9-4cff-81b6-cee9b1385b7c","object_id":9,"object_version":1,"objecttype":"main","pollable":true,"schema":"USER","session_self":true,"timestamp":"2019-03-13T10:41:07+01:00","type":"OBJECT_INSERT"},"user":{"_generated_displayname":"Root","_id":1}},{"_session":{"token":"ac554a02-3ef0-42da-8ffb-603d73de95f9"},"event":{"_id":57,"global_object_id":"10@ebe5e467-4da9-4cff-81b6-cee9b1385b7c","object_id":10,"object_version":1,"objecttype":"main","pollable":true,"schema":"USER","session_self":true,"timestamp":"2019-03-13T10:41:07+01:00","type":"OBJECT_INSERT"},"user":{"_generated_displayname":"Root","_id":1}},{"_session":{"token":"ac554a02-3ef0-42da-8ffb-603d73de95f9"},"event":{"_id":58,"global_object_id":"11@ebe5e467-4da9-4cff-81b6-cee9b1385b7c","object_id":11,"object_version":1,"objecttype":"main","pollable":true,"schema":"USER","session_self":true,"timestamp":"2019-03-13T10:41:07+01:00","type":"OBJECT_INSERT"},"user":{"_generated_displayname":"Root","_id":1}},{"_session":{"token":"ac554a02-3ef0-42da-8ffb-603d73de95f9"},"event":{"_id":59,"global_object_id":"12@ebe5e467-4da9-4cff-81b6-cee9b1385b7c","object_id":12,"object_version":1,"objecttype":"main","pollable":true,"schema":"USER","session_self":true,"timestamp":"2019-03-13T10:41:07+01:00","type":"OBJECT_INSERT"},"user":{"_generated_displayname":"Root","_id":1}},{"event":{"_id":60,"global_object_id":"5@ebe5e467-4da9-4cff-81b6-cee9b1385b7c","object_id":5,"object_version":1,"objecttype":"main","pollable":true,"schema":"USER","timestamp":"2019-03-13T10:41:07+01:00","type":"OBJECT_INDEX"}},{"event":{"_id":61,"global_object_id":"6@ebe5e467-4da9-4cff-81b6-cee9b1385b7c","object_id":6,"object_version":1,"objecttype":"main","pollable":true,"schema":"USER","timestamp":"2019-03-13T10:41:07+01:00","type":"OBJECT_INDEX"}},{"event":{"_id":62,"global_object_id":"3@ebe5e467-4da9-4cff-81b6-cee9b1385b7c","object_id":3,"object_version":1,"objecttype":"main","pollable":true,"schema":"USER","timestamp":"2019-03-13T10:41:07+01:00","type":"OBJECT_INDEX"}},{"event":{"_id":63,"global_object_id":"4@ebe5e467-4da9-4cff-81b6-cee9b1385b7c","object_id":4,"object_version":1,"objecttype":"main","pollable":true,"schema":"USER","timestamp":"2019-03-13T10:41:07+01:00","type":"OBJECT_INDEX"}},{"_session":{"token":"ac554a02-3ef0-42da-8ffb-603d73de95f9"},"event":{"_id":64,"global_object_id":"13@ebe5e467-4da9-4cff-81b6-cee9b1385b7c","object_id":13,"object_version":1,"objecttype":"main","pollable":true,"schema":"USER","session_self":true,"timestamp":"2019-03-13T10:41:07+01:00","type":"OBJECT_INSERT"},"user":{"_generated_displayname":"Root","_id":1}},{"_session":{"token":"ac554a02-3ef0-42da-8ffb-603d73de95f9"},"event":{"_id":65,"global_object_id":"14@ebe5e467-4da9-4cff-81b6-cee9b1385b7c","object_id":14,"object_version":1,"objecttype":"main","pollable":true,"schema":"USER","session_self":true,"timestamp":"2019-03-13T10:41:08+01:00","type":"OBJECT_INSERT"},"user":{"_generated_displayname":"Root","_id":1}},{"_session":{"token":"ac554a02-3ef0-42da-8ffb-603d73de95f9"},"event":{"_id":66,"global_object_id":"15@ebe5e467-4da9-4cff-81b6-cee9b1385b7c","object_id":15,"object_version":1,"objecttype":"main","pollable":true,"schema":"USER","session_self":true,"timestamp":"2019-03-13T10:41:08+01:00","type":"OBJECT_INSERT"},"user":{"_generated_displayname":"Root","_id":1}},{"_session":{"token":"ac554a02-3ef0-42da-8ffb-603d73de95f9"},"event":{"_id":67,"global_object_id":"16@ebe5e467-4da9-4cff-81b6-cee9b1385b7c","object_id":16,"object_version":1,"objecttype":"main","pollable":true,"schema":"USER","session_self":true,"timestamp":"2019-03-13T10:41:08+01:00","type":"OBJECT_INSERT"},"user":{"_generated_displayname":"Root","_id":1}},{"event":{"_id":68,"global_object_id":"8@ebe5e467-4da9-4cff-81b6-cee9b1385b7c","object_id":8,"object_version":1,"objecttype":"main","pollable":true,"schema":"USER","timestamp":"2019-03-13T10:41:08+01:00","type":"OBJECT_INDEX"}},{"event":{"_id":69,"global_object_id":"9@ebe5e467-4da9-4cff-81b6-cee9b1385b7c","object_id":9,"object_version":1,"objecttype":"main","pollable":true,"schema":"USER","timestamp":"2019-03-13T10:41:08+01:00","type":"OBJECT_INDEX"}},{"event":{"_id":70,"global_object_id":"7@ebe5e467-4da9-4cff-81b6-cee9b1385b7c","object_id":7,"object_version":1,"objecttype":"main","pollable":true,"schema":"USER","timestamp":"2019-03-13T10:41:08+01:00","type":"OBJECT_INDEX"}}],"header":{"Cache-Control":["no-cache"],"Content-Type":["application/json; charset=utf-8"],"Date":["Wed, 13 Mar 2019 09:41:16 GMT"],"Last-Modified":["Wed, 13 Mar 2019, 09:41:16 GMT"],"Pragma":["no-cache"],"Server":["Apache/2.4.25 (Debian)"],"Vary":["Origin,Accept-Encoding"],"X-Easydb-Api-Version":["1"],"X-Easydb-Base-Schema-Version":["207"],"X-Easydb-Solution":["simon"],"X-Easydb-User-Schema-Version":["2"]},"statuscode":200}`

fmt.Println(gjson.Get(jsolo, "body|@reverse|0.event._id"))
Expand Down Expand Up @@ -500,7 +500,7 @@ func TestCookieSetInDatastore(t *testing.T) {
"status": "done"
}
},
"store_response_qjson": {
"store_response_gjson": {
"sess_cookie": "cookie.sess"
}
}
Expand Down
4 changes: 2 additions & 2 deletions api_testsuite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func TestLoadManifest(t *testing.T) {

afero.WriteFile(filesystem.Fs, "externalFile", []byte(`{"load":{"me":"loaded"}}`), 644)

afero.WriteFile(filesystem.Fs, "testManifest.json", []byte(`{"testload": {{ file "externalFile" | qjson "load.me"}}}`), 644)
afero.WriteFile(filesystem.Fs, "testManifest.json", []byte(`{"testload": {{ file "externalFile" | gjson "load.me"}}}`), 644)

s := Suite{manifestPath: "testManifest.json"}

Expand All @@ -33,7 +33,7 @@ func TestLoadManifestCustomDelimiters(t *testing.T) {

afero.WriteFile(filesystem.Fs, "testManifest.json", []byte(`// template-delims: ## ##
// template-remove-tokens: "<placeholder>" "...."
{"testload": ## file "externalFile" | qjson "load.me" ##}"...."`), 0644)
{"testload": ## file "externalFile" | gjson "load.me" ##}"...."`), 0644)

s := Suite{manifestPath: "testManifest.json"}
res, err := s.loadManifest()
Expand Down
34 changes: 15 additions & 19 deletions internal/smtp/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ func (h *smtpHTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {

switch pathParts[0] {
case "gui":
h.routeGUIEndpoint(w, r, pathParts)
h.routeGUIEndpoint(w, pathParts)
case "postmessage":
h.handlePostMessage(w, r)
default:
h.routeMessageEndpoint(w, r, pathParts)
}
}

func (h *smtpHTTPHandler) routeGUIEndpoint(w http.ResponseWriter, r *http.Request, pathParts []string) {
func (h *smtpHTTPHandler) routeGUIEndpoint(w http.ResponseWriter, pathParts []string) {
if len(pathParts) == 0 {
handlerutil.RespondWithErr(
w, http.StatusInternalServerError,
Expand All @@ -87,7 +87,7 @@ func (h *smtpHTTPHandler) routeGUIEndpoint(w http.ResponseWriter, r *http.Reques
}

if len(pathParts) == 1 {
h.handleGUIIndex(w, r)
h.handleGUIIndex(w)
return
}

Expand All @@ -99,7 +99,7 @@ func (h *smtpHTTPHandler) routeGUIEndpoint(w http.ResponseWriter, r *http.Reques
}

if len(pathParts) == 2 {
h.handleGUIMessage(w, r, msg)
h.handleGUIMessage(w, msg)
return
}

Expand All @@ -122,11 +122,11 @@ func (h *smtpHTTPHandler) routeMessageEndpoint(w http.ResponseWriter, r *http.Re
}

if len(pathParts) == 1 {
h.handleMessageMeta(w, r, msg)
h.handleMessageMeta(w, msg)
return
}
if len(pathParts) == 2 && pathParts[1] == "raw" {
h.handleMessageRaw(w, r, msg)
h.handleMessageRaw(w, msg)
return
}

Expand All @@ -135,9 +135,7 @@ func (h *smtpHTTPHandler) routeMessageEndpoint(w http.ResponseWriter, r *http.Re

// subrouteContentEndpoint recursively finds a route for the remaining path parts
// based on the given ReceivedContent.
func (h *smtpHTTPHandler) subrouteContentEndpoint(
w http.ResponseWriter, r *http.Request, c *ReceivedContent, remainingPathParts []string,
) {
func (h *smtpHTTPHandler) subrouteContentEndpoint(w http.ResponseWriter, r *http.Request, c *ReceivedContent, remainingPathParts []string) {
ensureIsMultipart := func() bool {
if !c.IsMultipart() {
handlerutil.RespondWithErr(w, http.StatusNotFound, fmt.Errorf(
Expand All @@ -152,7 +150,7 @@ func (h *smtpHTTPHandler) subrouteContentEndpoint(
if len(remainingPathParts) == 1 {
switch remainingPathParts[0] {
case "body":
h.handleContentBody(w, r, c)
h.handleContentBody(w, c)
return
case "multipart":
if !ensureIsMultipart() {
Expand Down Expand Up @@ -190,7 +188,7 @@ func (h *smtpHTTPHandler) subrouteContentEndpoint(
part := multiparts[partIdx]

if len(remainingPathParts) == 2 {
h.handleMultipartMeta(w, r, part)
h.handleMultipartMeta(w, part)
return
}

Expand All @@ -202,7 +200,7 @@ func (h *smtpHTTPHandler) subrouteContentEndpoint(
w.WriteHeader(http.StatusNotFound)
}

func (h *smtpHTTPHandler) handleContentBody(w http.ResponseWriter, r *http.Request, c *ReceivedContent) {
func (h *smtpHTTPHandler) handleContentBody(w http.ResponseWriter, c *ReceivedContent) {
contentType, ok := c.Headers()["Content-Type"]
if ok {
w.Header()["Content-Type"] = contentType
Expand All @@ -211,7 +209,7 @@ func (h *smtpHTTPHandler) handleContentBody(w http.ResponseWriter, r *http.Reque
w.Write(c.Body())
}

func (h *smtpHTTPHandler) handleGUIIndex(w http.ResponseWriter, r *http.Request) {
func (h *smtpHTTPHandler) handleGUIIndex(w http.ResponseWriter) {
w.Header().Set("Content-Type", "text/html; charset=utf-8")

err := guiIndexTemplate.Execute(w, map[string]any{"prefix": h.prefix})
Expand All @@ -220,7 +218,7 @@ func (h *smtpHTTPHandler) handleGUIIndex(w http.ResponseWriter, r *http.Request)
}
}

func (h *smtpHTTPHandler) handleGUIMessage(w http.ResponseWriter, r *http.Request, msg *ReceivedMessage) {
func (h *smtpHTTPHandler) handleGUIMessage(w http.ResponseWriter, msg *ReceivedMessage) {
metadata := buildMessageFullMeta(msg)
metadataJson := golib.JsonStringIndent(metadata, "", " ")

Expand Down Expand Up @@ -261,11 +259,11 @@ func (h *smtpHTTPHandler) handleMessageIndex(w http.ResponseWriter, r *http.Requ
handlerutil.RespondWithJSON(w, http.StatusOK, out)
}

func (h *smtpHTTPHandler) handleMessageMeta(w http.ResponseWriter, r *http.Request, msg *ReceivedMessage) {
func (h *smtpHTTPHandler) handleMessageMeta(w http.ResponseWriter, msg *ReceivedMessage) {
handlerutil.RespondWithJSON(w, http.StatusOK, buildMessageFullMeta(msg))
}

func (h *smtpHTTPHandler) handleMessageRaw(w http.ResponseWriter, r *http.Request, msg *ReceivedMessage) {
func (h *smtpHTTPHandler) handleMessageRaw(w http.ResponseWriter, msg *ReceivedMessage) {
w.Header().Set("Content-Type", "message/rfc822")
w.Write(msg.RawMessageData())
}
Expand All @@ -285,9 +283,7 @@ func (h *smtpHTTPHandler) handleMultipartIndex(w http.ResponseWriter, r *http.Re
handlerutil.RespondWithJSON(w, http.StatusOK, buildMultipartIndex(multiparts))
}

func (h *smtpHTTPHandler) handleMultipartMeta(
w http.ResponseWriter, r *http.Request, part *ReceivedPart,
) {
func (h *smtpHTTPHandler) handleMultipartMeta(w http.ResponseWriter, part *ReceivedPart) {
handlerutil.RespondWithJSON(w, http.StatusOK, buildMultipartMeta(part))
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/lib/datastore/datastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ func (data DatastoreIndexError) Error() string {
return data.error
}

// SetWithQjson stores the given response driven by a map key => qjson
func (ds *Datastore) SetWithQjson(jsonResponse string, storeResponse map[string]string) error {
// SetWithGjson stores the given response driven by a map key => gjson
func (ds *Datastore) SetWithGjson(jsonResponse string, storeResponse map[string]string) error {
for k, qv := range storeResponse {
setEmpty := false
if len(qv) > 0 && qv[0] == '!' {
Expand Down
4 changes: 2 additions & 2 deletions pkg/lib/datastore/datastore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestDataStore_GetSlice(t *testing.T) {
func TestStoreTypeInt(t *testing.T) {
store := NewStore(false)
store.Set("ownInt", 1.0)
store.SetWithQjson(`{"id",1.000000}`, map[string]string{"jsonInt": "id"})
store.SetWithGjson(`{"id",1.000000}`, map[string]string{"jsonInt": "id"})

oVal, _ := store.Get("ownInt")
jVal, _ := store.Get("jsonInt")
Expand All @@ -48,7 +48,7 @@ func TestStoreTypeInt(t *testing.T) {
}

store.Set("ownInt", 1.1)
store.SetWithQjson(`{"id",1.100000}`, map[string]string{"jsonInt": "id"})
store.SetWithGjson(`{"id",1.100000}`, map[string]string{"jsonInt": "id"})

oVal, _ = store.Get("ownInt")
jVal, _ = store.Get("jsonInt")
Expand Down
6 changes: 0 additions & 6 deletions pkg/lib/template/template_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,8 @@ import (
"github.com/pkg/errors"
"github.com/programmfabrik/apitest/pkg/lib/csv"
"github.com/programmfabrik/apitest/pkg/lib/util"
"github.com/tidwall/gjson"
)

func qjson(path string, json string) string {
result := gjson.Get(json, path)
return result.Raw
}

// N returns a slice of n 0-sized elements, suitable for ranging over. (github.com/bradfitz)
func N(n any) ([]struct{}, error) {
switch v := n.(type) {
Expand Down
32 changes: 0 additions & 32 deletions pkg/lib/template/template_funcs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,10 @@ import (
"reflect"
"testing"

"github.com/programmfabrik/apitest/pkg/lib/test_utils"
go_test_utils "github.com/programmfabrik/go-test-utils"
"github.com/stretchr/testify/assert"
)

func Test_QJson_String(t *testing.T) {
json := `{
"foo": "bar"
}`
go_test_utils.AssertStringEquals(t, qjson("foo", json), `"bar"`)
}

func Test_QJson_Array(t *testing.T) {
json := `{
"foo": [
"bar",
1
]
}`
test_utils.AssertJsonStringEquals(t, qjson("foo", json), `[
"bar",
1
]`)
}

func Test_QJson_Object(t *testing.T) {
json := `{
"foo": {
"bar": 1
}
}`
test_utils.AssertJsonStringEquals(t, qjson("foo", json), `{
"bar": 1
}`)
}

func TestRowsToMap(t *testing.T) {
tests := []struct {
In []map[string]any
Expand Down
4 changes: 2 additions & 2 deletions pkg/lib/template/template_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ func (loader *Loader) Render(
}

funcMap := template.FuncMap{
"qjson": func(path string, json string) (result string, err error) {
"gjson": func(path string, json string) (result string, err error) {
if json == "" {
err = fmt.Errorf("The given json was empty")
return
}

result = gjson.Get(json, path).Raw
if len(result) == 0 {
err = fmt.Errorf("'%s' was not found or was empty string. Qjson Input: %s", path, json)
err = fmt.Errorf("'%s' was not found or was empty string. Gjson Input: %s", path, json)
}
return
},
Expand Down
Loading
Loading