Skip to content

Commit

Permalink
slight improvement unit interface
Browse files Browse the repository at this point in the history
  • Loading branch information
lucamrgs committed Jan 20, 2025
1 parent 5a4f8af commit 800c527
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions pkg/api/manual/manual_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"soarca/internal/logger"
"soarca/pkg/core/capability/manual/interaction"
"soarca/pkg/models/api"
"soarca/pkg/models/cacao"
"soarca/pkg/models/execution"
"soarca/pkg/models/manual"

Expand Down Expand Up @@ -166,15 +167,8 @@ func (manualHandler *ManualHandler) PostContinue(g *gin.Context) {
return
}

for varName, variable := range outArgsUpdate.ResponseOutArgs {
if varName != variable.Name {
log.Error("variable name mismatch")
apiError.SendErrorResponse(g, http.StatusBadRequest,
"Variable name mismatch",
"POST /manual/continue", "")
return
}
}
// Check if variable names match
manualHandler.postContinueVariableNamesMatchCheck(outArgsUpdate.ResponseOutArgs, g)

// Create object to pass to interaction capability
executionId, err := uuid.Parse(outArgsUpdate.ExecutionId)
Expand Down Expand Up @@ -246,3 +240,15 @@ func (manualHandler *ManualHandler) parseCommandInfoToResponse(commandInfo manua

return response
}

func (ManualHandler *ManualHandler) postContinueVariableNamesMatchCheck(outArgs cacao.Variables, g *gin.Context) {
for varName, variable := range outArgs {
if varName != variable.Name {
log.Error("variable name mismatch")
apiError.SendErrorResponse(g, http.StatusBadRequest,
"Variable name mismatch",
"POST /manual/continue", "")
return
}
}
}

0 comments on commit 800c527

Please sign in to comment.