From 41370a2f120b0cbbbc9e4397fc316a5a1424d1e2 Mon Sep 17 00:00:00 2001 From: mkravos Date: Thu, 13 Jun 2024 16:45:20 -0500 Subject: [PATCH] Minor fixes to BuildMessage --- command/call/execute.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/command/call/execute.go b/command/call/execute.go index bb82597..1b57458 100644 --- a/command/call/execute.go +++ b/command/call/execute.go @@ -12,9 +12,10 @@ package call import ( "fmt" - "github.com/percipia/eslgo/command" "net/textproto" "strconv" + + "github.com/percipia/eslgo/command" ) type Execute struct { @@ -73,7 +74,7 @@ func (e *Execute) BuildMessage() string { } sendMsg := command.SendMessage{ UUID: e.UUID, - Headers: make(textproto.MIMEHeader), + Headers: make(textproto.MIMEHeader, 4), // preallocating for the 4+ headers that are always set to reduce amount of dynamic allocations Sync: e.Sync, SyncPri: e.SyncPri, } @@ -87,8 +88,8 @@ func (e *Execute) BuildMessage() string { // According to documentation that is the max header length if len(e.AppArgs) > 2048 || e.ForceBody { - sendMsg.Headers.Set("content-type", "text/plain") - sendMsg.Headers.Set("content-length", strconv.Itoa(len(e.AppArgs))) + sendMsg.Headers.Set("Content-Type", "text/plain") + sendMsg.Headers.Set("Content-Length", strconv.Itoa(len(e.AppArgs))) sendMsg.Body = e.AppArgs } else { sendMsg.Headers.Set("execute-app-arg", e.AppArgs)