httpmock
该库建立在Go内置的库的基础上,添加了一个更具可界面,可以轻松地与其他工具(如。 它通过提供一个将HTTP组件作为单独的参数而不是单个*http.Request对象的Handler来*http.Request 。
典型的接口为:
type Handler interface {
ServeHTTP ( ResponseWriter , * Request )
}
该库为服务器提供了具有以下接口的服务器,该接口自然可与模拟库一起使用:
// Handler is the interface used by httpmock instead of http.Handl