File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -28,9 +28,6 @@ func NewMocks(ms services.Mocks) *Mocks {
2828}
2929
3030func (m * Mocks ) GenericHandler (c echo.Context ) error {
31- m .mu .Lock ()
32- defer m .mu .Unlock ()
33-
3431 actualRequest := types .HTTPRequestToRequest (c .Request ())
3532 b , _ := yaml .Marshal (actualRequest )
3633 log .Debugf ("Received request:\n ---\n %s\n " , string (b ))
@@ -91,7 +88,9 @@ func (m *Mocks) GenericHandler(c echo.Context) error {
9188 response = mock .Response
9289 }
9390
91+ m .mu .Lock ()
9492 matchingMock .State .TimesCount ++
93+ m .mu .Unlock ()
9594 break
9695 } else {
9796 b , _ = yaml .Marshal (mock )
@@ -107,7 +106,9 @@ func (m *Mocks) GenericHandler(c echo.Context) error {
107106
108107 if len (exceededMocks ) > 0 {
109108 for _ , mock := range exceededMocks {
109+ m .mu .Lock ()
110110 mock .State .TimesCount ++
111+ m .mu .Unlock ()
111112 }
112113 resp ["message" ] = types .SmockerMockExceeded
113114 resp ["nearest" ] = exceededMocks
You can’t perform that action at this time.
0 commit comments