Skip to content

Commit

Permalink
#1007 fix nil pointer error for middleware script
Browse files Browse the repository at this point in the history
  • Loading branch information
tommysitu committed Feb 21, 2022
1 parent 074e419 commit 2e47721
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions core/middleware/local_middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ import (

// ExecuteMiddleware - takes command (middleware string) and payload, which is passed to middleware
func (this Middleware) executeMiddlewareLocally(pair models.RequestResponsePair) (models.RequestResponsePair, error) {
commandAndArgs := []string{this.Binary, this.Script.Name()}

middlewareCommand := exec.Command(commandAndArgs[0], commandAndArgs[1:]...)
var middlewareCommand *exec.Cmd
if this.Script == nil {
middlewareCommand = exec.Command(this.Binary)
} else {
middlewareCommand = exec.Command(this.Binary, this.Script.Name())
}

pairViewBytes, err := json.Marshal(pair.ConvertToRequestResponsePairView())
if err != nil {
Expand Down

0 comments on commit 2e47721

Please sign in to comment.