Skip to content

Commit 9a76195

Browse files
javutoCopilot
andauthored
Update cmd/cli/api-node.go
Use `bytes.NewReader(jsonMessage)` instead of converting to string to avoid unnecessary memory allocation. Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent ba2945f commit 9a76195

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

cmd/cli/api-node.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func (api *OsctrlAPI) LookupNode(identifier string) (nodes.OsqueryNode, error) {
7474
if err != nil {
7575
return node, fmt.Errorf("error marshaling data %w", err)
7676
}
77-
jsonParam := strings.NewReader(string(jsonMessage))
77+
jsonParam := bytes.NewReader(jsonMessage)
7878
reqURL := fmt.Sprintf("%s%s%s/lookup", api.Configuration.URL, APIPath, APINodes)
7979
rawNode, err := api.PostGeneric(reqURL, jsonParam)
8080
if err != nil {

0 commit comments

Comments
 (0)