@@ -102,12 +102,16 @@ func cassetteBodyMatcher(request *http.Request, cassette cassette.Request) bool
102102
103103 r , err := request .GetBody ()
104104 if err != nil {
105- panic (fmt .Errorf ("cassette body matcher: failed to copy request body: %w" , err )) // lintignore: R009
105+ logging .L .Errorf ("cassette body matcher: failed to copy request body: %v" , err )
106+
107+ return false
106108 }
107109
108110 requestBody , err := io .ReadAll (r )
109111 if err != nil {
110- panic (fmt .Errorf ("cassette body matcher: failed to read actualRequest body: %w" , err )) // lintignore: R009
112+ logging .L .Errorf ("cassette body matcher: failed to read actualRequest body: %v" , err )
113+
114+ return false
111115 }
112116
113117 // Try to match raw bodies if they are not JSON (ex: cloud-init config)
@@ -127,7 +131,9 @@ func cassetteBodyMatcher(request *http.Request, cassette cassette.Request) bool
127131 if ! json .Valid (requestBody ) {
128132 requestValues , err := url .ParseQuery (string (requestBody ))
129133 if err != nil {
130- panic (fmt .Errorf ("cassette body matcher: failed to parse body as url values: %w" , err )) // lintignore: R009
134+ logging .L .Errorf ("cassette body matcher: failed to parse body as url values: %v" , err )
135+
136+ return false
131137 }
132138
133139 // Remove keys that should be ignored during comparison
@@ -140,7 +146,9 @@ func cassetteBodyMatcher(request *http.Request, cassette cassette.Request) bool
140146
141147 err = json .Unmarshal (requestBody , & requestJSON )
142148 if err != nil {
143- panic (fmt .Errorf ("cassette body matcher: failed to parse request body as json: %w" , err )) // lintignore: R009
149+ logging .L .Errorf ("cassette body matcher: failed to parse request body as json: %v" , err )
150+
151+ return false
144152 }
145153
146154 err = json .Unmarshal ([]byte (cassette .Body ), & cassetteJSON )
0 commit comments