Skip to content

Commit 6f11d3e

Browse files
authored
Merge pull request #34 from StephanHCB/fix_npe
fix(RELTEC-12253): prevent nil pointer reference in RoundTripper
2 parents 94ba915 + ab19e2d commit 6f11d3e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

implementation/capture/roundtripper.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ func (c *RequestCaptureImpl) RoundTrip(req *http.Request) (*http.Response, error
2323

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

26-
newReader := strings.NewReader(string(**(parsedResponse.Body.(**[]byte))))
27-
readCloser := io.NopCloser(newReader)
26+
var readCloser io.ReadCloser
27+
if parsedResponse.Body != nil {
28+
newReader := strings.NewReader(string(**(parsedResponse.Body.(**[]byte))))
29+
readCloser = io.NopCloser(newReader)
30+
}
2831

2932
return &http.Response{
3033
Status: "",

0 commit comments

Comments
 (0)