(_ context.Context, logger *zap.Logger, m []*models.Mock, mocksPresentInMapping []string)
| 3550 | } |
| 3551 | |
| 3552 | func filterByMapping(_ context.Context, logger *zap.Logger, m []*models.Mock, mocksPresentInMapping []string) ([]*models.Mock, []*models.Mock) { |
| 3553 | mapping := make(map[string]bool, len(mocksPresentInMapping)) |
| 3554 | for _, name := range mocksPresentInMapping { |
| 3555 | mapping[name] = true |
| 3556 | } |
| 3557 | var filtered, unfiltered []*models.Mock |
| 3558 | isNonKeploy := false |
| 3559 | for _, mock := range m { |
| 3560 | if mock == nil { |
| 3561 | continue |
| 3562 | } |
| 3563 | p := mock.DeepCopy() |
| 3564 | if p.Version != "api.keploy.io/v1beta1" && p.Version != "api.keploy.io/v1beta2" { |
| 3565 | isNonKeploy = true |
| 3566 | } |
| 3567 | if mapping[p.Name] { |
| 3568 | p.TestModeInfo.IsFiltered = true |
| 3569 | filtered = append(filtered, p) |
| 3570 | } else { |
| 3571 | p.TestModeInfo.IsFiltered = false |
| 3572 | unfiltered = append(unfiltered, p) |
| 3573 | } |
| 3574 | } |
| 3575 | if isNonKeploy { |
| 3576 | logger.Debug("Few mocks in the mock File are not recorded by keploy ignoring them") |
| 3577 | } |
| 3578 | return filtered, unfiltered |
| 3579 | } |
| 3580 | |
| 3581 | func GuessContentType(data []byte) models.BodyType { |
| 3582 | // Use net/http library's DetectContentType for basic MIME type detection |
no test coverage detected