diff --git a/executors/http/http.go b/executors/http/http.go index 579fc79f..aee0171a 100644 --- a/executors/http/http.go +++ b/executors/http/http.go @@ -265,7 +265,11 @@ func (e Executor) getRequest(ctx context.Context, workdir string) (*http.Request if e.Body != "" { body = bytes.NewBuffer([]byte(e.Body)) } else if e.BodyFile != "" { - bodyfilePath := filepath.Join(workdir, e.BodyFile) + bodyfilePath := e.BodyFile + if !filepath.IsAbs(e.BodyFile) { + // Only join with the workdir with relative path + bodyfilePath = filepath.Join(workdir, e.BodyFile) + } if _, err := os.Stat(bodyfilePath); !os.IsNotExist(err) { temp, err := os.ReadFile(bodyfilePath) if err != nil { diff --git a/tests/case.yml b/tests/case.yml index fa67630d..da5f0297 100644 --- a/tests/case.yml +++ b/tests/case.yml @@ -1,7 +1,7 @@ -name: Readfile testsuite +name: case testsuite testcases: -- name: testcase-readfile +- name: testcase-case steps: - script: 'echo "{\"foo\": \"foo\", \"FOO\": \"bar\"}"' info: "{{.result.systemoutjson.foo}}-{{.result.systemoutjson.FOO}}"