vendredi 28 avril 2017

Data race when using Gock with HTTP calls in goroutine

I am mocking my HTTP calls during tests with Gock and it works well unless I run the HTTP call from a separate goroutine (think go Post("https://myapi.com", "this body"). I don't really care about the HTTP response in this case and just want to fire the request.

This results in a race condition between http.Client.send() and gock.New(). Is there a way around it or what is the recommended way to mock the API calls in this case?

Thanks!

Aucun commentaire:

Enregistrer un commentaire