From edaaaee6a31cf5dedfc7427f3634a5b6697e9507 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Thu, 23 Sep 2021 11:50:17 +0800 Subject: [PATCH] fix: init step request --- .gitignore | 2 ++ step.go | 43 ++++++++++++++++++++++++++++--------------- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 66fd13c9..d6993ff2 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,5 @@ # Dependency directories (remove the comment below to include it) # vendor/ + +__debug_bin \ No newline at end of file diff --git a/step.go b/step.go index d64b2b36..e5920b50 100644 --- a/step.go +++ b/step.go @@ -6,7 +6,6 @@ func Step(name string) *step { return &step{ TStep: &TStep{ Name: name, - Request: &TRequest{}, Variables: make(map[string]interface{}), }, } @@ -27,56 +26,70 @@ func (s *step) SetupHook(hook string) *step { } func (s *step) GET(url string) *requestWithOptionalArgs { - s.TStep.Request.Method = GET - s.TStep.Request.URL = url + s.TStep.Request = &TRequest{ + Method: GET, + URL: url, + } return &requestWithOptionalArgs{ step: s.TStep, } } func (s *step) HEAD(url string) *requestWithOptionalArgs { - s.TStep.Request.Method = HEAD - s.TStep.Request.URL = url + s.TStep.Request = &TRequest{ + Method: HEAD, + URL: url, + } return &requestWithOptionalArgs{ step: s.TStep, } } func (s *step) POST(url string) *requestWithOptionalArgs { - s.TStep.Request.Method = POST - s.TStep.Request.URL = url + s.TStep.Request = &TRequest{ + Method: POST, + URL: url, + } return &requestWithOptionalArgs{ step: s.TStep, } } func (s *step) PUT(url string) *requestWithOptionalArgs { - s.TStep.Request.Method = PUT - s.TStep.Request.URL = url + s.TStep.Request = &TRequest{ + Method: PUT, + URL: url, + } return &requestWithOptionalArgs{ step: s.TStep, } } func (s *step) DELETE(url string) *requestWithOptionalArgs { - s.TStep.Request.Method = DELETE - s.TStep.Request.URL = url + s.TStep.Request = &TRequest{ + Method: DELETE, + URL: url, + } return &requestWithOptionalArgs{ step: s.TStep, } } func (s *step) OPTIONS(url string) *requestWithOptionalArgs { - s.TStep.Request.Method = OPTIONS - s.TStep.Request.URL = url + s.TStep.Request = &TRequest{ + Method: OPTIONS, + URL: url, + } return &requestWithOptionalArgs{ step: s.TStep, } } func (s *step) PATCH(url string) *requestWithOptionalArgs { - s.TStep.Request.Method = PATCH - s.TStep.Request.URL = url + s.TStep.Request = &TRequest{ + Method: PATCH, + URL: url, + } return &requestWithOptionalArgs{ step: s.TStep, }