best way to mock/unit test http.Client?

This page summarizes the projects mentioned and recommended in the original post on

Our great sponsors
  • Scout APM - Less time debugging, more time building
  • SonarQube - Static code analysis for 29 languages.
  • OPS - Build and Run Open Source Unikernels
  • GitHub repo gock

    HTTP traffic mocking and testing made easy in Go ༼ʘ̚ل͜ʘ̚༽

  • GitHub repo go-vcr

    Record and replay your HTTP interactions for fast, deterministic and accurate tests


  • Scout APM

    Less time debugging, more time building. Scout APM allows you to find and fix performance issues with no hassle. Now with error monitoring and external services monitoring, Scout is a developer's best friend when it comes to application development.

  • GitHub repo gaia

    Build powerful pipelines in any programming language.

    Something like this:

  • GitHub repo httpmock

    HTTP mocking for Golang

    To mock an API: to use when your code calls external APIs so you don't want your tests call the real API. No need to create an interface as you do.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts