Skip to content

Commit

Permalink
Merge pull request #34 from StephanHCB/fix_npe
Browse files Browse the repository at this point in the history
fix(RELTEC-12253): prevent nil pointer reference in RoundTripper
  • Loading branch information
StephanHCB authored Dec 15, 2024
2 parents 94ba915 + ab19e2d commit 6f11d3e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions implementation/capture/roundtripper.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ func (c *RequestCaptureImpl) RoundTrip(req *http.Request) (*http.Response, error

err := c.Wrapped.Perform(req.Context(), req.Method, req.URL.String(), req.Body, &parsedResponse)

newReader := strings.NewReader(string(**(parsedResponse.Body.(**[]byte))))
readCloser := io.NopCloser(newReader)
var readCloser io.ReadCloser
if parsedResponse.Body != nil {
newReader := strings.NewReader(string(**(parsedResponse.Body.(**[]byte))))
readCloser = io.NopCloser(newReader)
}

return &http.Response{
Status: "",
Expand Down

0 comments on commit 6f11d3e

Please sign in to comment.