mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-09 09:49:33 +08:00
fix: init step request
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -13,3 +13,5 @@
|
|||||||
|
|
||||||
# Dependency directories (remove the comment below to include it)
|
# Dependency directories (remove the comment below to include it)
|
||||||
# vendor/
|
# vendor/
|
||||||
|
|
||||||
|
__debug_bin
|
||||||
43
step.go
43
step.go
@@ -6,7 +6,6 @@ func Step(name string) *step {
|
|||||||
return &step{
|
return &step{
|
||||||
TStep: &TStep{
|
TStep: &TStep{
|
||||||
Name: name,
|
Name: name,
|
||||||
Request: &TRequest{},
|
|
||||||
Variables: make(map[string]interface{}),
|
Variables: make(map[string]interface{}),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -27,56 +26,70 @@ func (s *step) SetupHook(hook string) *step {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *step) GET(url string) *requestWithOptionalArgs {
|
func (s *step) GET(url string) *requestWithOptionalArgs {
|
||||||
s.TStep.Request.Method = GET
|
s.TStep.Request = &TRequest{
|
||||||
s.TStep.Request.URL = url
|
Method: GET,
|
||||||
|
URL: url,
|
||||||
|
}
|
||||||
return &requestWithOptionalArgs{
|
return &requestWithOptionalArgs{
|
||||||
step: s.TStep,
|
step: s.TStep,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *step) HEAD(url string) *requestWithOptionalArgs {
|
func (s *step) HEAD(url string) *requestWithOptionalArgs {
|
||||||
s.TStep.Request.Method = HEAD
|
s.TStep.Request = &TRequest{
|
||||||
s.TStep.Request.URL = url
|
Method: HEAD,
|
||||||
|
URL: url,
|
||||||
|
}
|
||||||
return &requestWithOptionalArgs{
|
return &requestWithOptionalArgs{
|
||||||
step: s.TStep,
|
step: s.TStep,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *step) POST(url string) *requestWithOptionalArgs {
|
func (s *step) POST(url string) *requestWithOptionalArgs {
|
||||||
s.TStep.Request.Method = POST
|
s.TStep.Request = &TRequest{
|
||||||
s.TStep.Request.URL = url
|
Method: POST,
|
||||||
|
URL: url,
|
||||||
|
}
|
||||||
return &requestWithOptionalArgs{
|
return &requestWithOptionalArgs{
|
||||||
step: s.TStep,
|
step: s.TStep,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *step) PUT(url string) *requestWithOptionalArgs {
|
func (s *step) PUT(url string) *requestWithOptionalArgs {
|
||||||
s.TStep.Request.Method = PUT
|
s.TStep.Request = &TRequest{
|
||||||
s.TStep.Request.URL = url
|
Method: PUT,
|
||||||
|
URL: url,
|
||||||
|
}
|
||||||
return &requestWithOptionalArgs{
|
return &requestWithOptionalArgs{
|
||||||
step: s.TStep,
|
step: s.TStep,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *step) DELETE(url string) *requestWithOptionalArgs {
|
func (s *step) DELETE(url string) *requestWithOptionalArgs {
|
||||||
s.TStep.Request.Method = DELETE
|
s.TStep.Request = &TRequest{
|
||||||
s.TStep.Request.URL = url
|
Method: DELETE,
|
||||||
|
URL: url,
|
||||||
|
}
|
||||||
return &requestWithOptionalArgs{
|
return &requestWithOptionalArgs{
|
||||||
step: s.TStep,
|
step: s.TStep,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *step) OPTIONS(url string) *requestWithOptionalArgs {
|
func (s *step) OPTIONS(url string) *requestWithOptionalArgs {
|
||||||
s.TStep.Request.Method = OPTIONS
|
s.TStep.Request = &TRequest{
|
||||||
s.TStep.Request.URL = url
|
Method: OPTIONS,
|
||||||
|
URL: url,
|
||||||
|
}
|
||||||
return &requestWithOptionalArgs{
|
return &requestWithOptionalArgs{
|
||||||
step: s.TStep,
|
step: s.TStep,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *step) PATCH(url string) *requestWithOptionalArgs {
|
func (s *step) PATCH(url string) *requestWithOptionalArgs {
|
||||||
s.TStep.Request.Method = PATCH
|
s.TStep.Request = &TRequest{
|
||||||
s.TStep.Request.URL = url
|
Method: PATCH,
|
||||||
|
URL: url,
|
||||||
|
}
|
||||||
return &requestWithOptionalArgs{
|
return &requestWithOptionalArgs{
|
||||||
step: s.TStep,
|
step: s.TStep,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user