Skip to content

Commit

Permalink
Add equivalent curl as debug
Browse files Browse the repository at this point in the history
  • Loading branch information
lloesche committed Jul 25, 2024
1 parent d9eaa5a commit 544333e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion search/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (
"fmt"
"io"
"net/http"

"github.com/sirupsen/logrus"
)

type SearchRequest struct {
Expand Down Expand Up @@ -47,6 +49,9 @@ func SearchGraph(apiEndpoint, fixJWT, workspaceID, searchStr string, withEdges b
Secure: true,
})

curlCommand := fmt.Sprintf("curl -X POST -H 'Content-Type: application/json' -H 'Accept: application/ndjson' -H 'Cookie: session_token=%s' -d '%s' %s", fixJWT, string(requestBody), url)

Check failure

Code scanning / CodeQL

Potentially unsafe quoting Critical

If this
JSON value
contains a single quote, it could break out of the enclosing quotes.
logrus.Debugln("Equivalent curl command:", curlCommand)

client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
Expand Down Expand Up @@ -76,7 +81,7 @@ func SearchGraph(apiEndpoint, fixJWT, workspaceID, searchStr string, withEdges b

var result interface{}
if err := decoder.Decode(&result); err != nil {
errs <- fmt.Errorf("error unmarshaling JSON: %w", err)
errs <- fmt.Errorf("error unmarshalling JSON: %w", err)
return
}
results <- result
Expand Down

0 comments on commit 544333e

Please sign in to comment.