Skip to content

Commit 00bb185

Browse files
committed
Cleanup chain checks in request
1 parent 908b657 commit 00bb185

1 file changed

Lines changed: 4 additions & 16 deletions

File tree

request.go

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2011,6 +2011,10 @@ func (r *Request) execute(opChain *chain) *Response {
20112011

20122012
for _, transform := range r.transformers {
20132013
transform(r.httpReq)
2014+
2015+
if opChain.failed() {
2016+
return nil
2017+
}
20142018
}
20152019

20162020
var (
@@ -2038,10 +2042,6 @@ func (r *Request) execute(opChain *chain) *Response {
20382042
}
20392043

20402044
func (r *Request) encodeRequest(opChain *chain) bool {
2041-
if opChain.failed() {
2042-
return false
2043-
}
2044-
20452045
r.httpReq.URL.Path = concatPaths(r.httpReq.URL.Path, r.path)
20462046

20472047
if r.query != nil {
@@ -2086,10 +2086,6 @@ var websocketErr = `webocket request can not have body:
20862086
webocket was enabled by WithWebsocketUpgrade()`
20872087

20882088
func (r *Request) encodeWebsocketRequest(opChain *chain) bool {
2089-
if opChain.failed() {
2090-
return false
2091-
}
2092-
20932089
if r.bodySetter != "" {
20942090
opChain.fail(AssertionFailure{
20952091
Type: AssertUsage,
@@ -2111,10 +2107,6 @@ func (r *Request) encodeWebsocketRequest(opChain *chain) bool {
21112107
}
21122108

21132109
func (r *Request) sendRequest(opChain *chain) (*http.Response, time.Duration) {
2114-
if opChain.failed() {
2115-
return nil, 0
2116-
}
2117-
21182110
resp, elapsed, err := r.retryRequest(func() (*http.Response, error) {
21192111
return r.config.Client.Do(r.httpReq)
21202112
})
@@ -2136,10 +2128,6 @@ func (r *Request) sendRequest(opChain *chain) (*http.Response, time.Duration) {
21362128
func (r *Request) sendWebsocketRequest(opChain *chain) (
21372129
*http.Response, *websocket.Conn, time.Duration,
21382130
) {
2139-
if opChain.failed() {
2140-
return nil, nil, 0
2141-
}
2142-
21432131
var conn *websocket.Conn
21442132
resp, elapsed, err := r.retryRequest(func() (resp *http.Response, err error) {
21452133
conn, resp, err = r.config.WebsocketDialer.Dial(

0 commit comments

Comments
 (0)