Skip to content

Commit

Permalink
create error beresp only for missing real beresp
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Koch committed May 5, 2022
1 parent de95e2f commit ac98655
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions handler/transport/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,15 @@ func (b *Backend) RoundTrip(req *http.Request) (*http.Response, error) {
}

if err != nil {
berespErr := &http.Response{
Request: req,
} // provide outreq (variable) on error cases
if beresp == nil {
beresp = &http.Response{
Request: req,
} // provide outreq (variable) on error cases
}
if varSync, ok := req.Context().Value(request.ContextVariablesSynced).(*eval.SyncedVariables); ok {
varSync.Set(berespErr)
varSync.Set(beresp)
}
return berespErr, err
return beresp, err
}

if retry, rerr := b.withRetryTokenRequest(req, beresp); rerr != nil {
Expand Down

0 comments on commit ac98655

Please sign in to comment.