github.com/kubeshop/testkube@v1.17.23/contrib/executor/curl/pkg/runner/runner_input.go (about)

     1  package runner
     2  
     3  // CurlRunnerInput is the input for the CurlRunner
     4  type CurlRunnerInput struct {
     5  	Command        []string `json:"command"`
     6  	ExpectedStatus string   `json:"expected_status"`
     7  	ExpectedBody   string   `json:"expected_body"`
     8  }
     9  
    10  // FillTemplates resolves the templates from the CurlRunnerInput against the values in the param
    11  func (runnerInput *CurlRunnerInput) FillTemplates(params map[string]string) error {
    12  
    13  	err := ResolveTemplates(runnerInput.Command, params)
    14  	if err != nil {
    15  		return err
    16  	}
    17  
    18  	runnerInput.ExpectedBody, err = ResolveTemplate(runnerInput.ExpectedBody, params)
    19  	if err != nil {
    20  		return err
    21  	}
    22  
    23  	runnerInput.ExpectedStatus, err = ResolveTemplate(runnerInput.ExpectedStatus, params)
    24  	if err != nil {
    25  		return err
    26  	}
    27  
    28  	return nil
    29  }