Improve error handling in LoadCaptureFromArchive and handleResponse methods

This commit is contained in:
ProtoTess
2025-11-11 02:36:36 +00:00
parent c3e6ed80c1
commit f5280f8c0e
+3 -3
View File
@@ -37,13 +37,13 @@ func LoadCaptureFromArchive(archivePath string) (*CameraCapture, error) {
if err != nil {
return nil, fmt.Errorf("failed to open archive: %w", err)
}
defer file.Close()
defer func() { _ = file.Close() }()
gzr, err := gzip.NewReader(file)
if err != nil {
return nil, fmt.Errorf("failed to create gzip reader: %w", err)
}
defer gzr.Close()
defer func() { _ = gzr.Close() }()
tr := tar.NewReader(gzr)
@@ -150,7 +150,7 @@ func (m *MockSOAPServer) handleRequest(w http.ResponseWriter, r *http.Request) {
// Return the captured response
w.Header().Set("Content-Type", "application/soap+xml; charset=utf-8")
w.WriteHeader(exchange.StatusCode)
w.Write([]byte(exchange.ResponseBody))
_, _ = w.Write([]byte(exchange.ResponseBody))
}
// Close shuts down the mock server