mirror of
https://github.com/sstent/aicyclingcoach-go.git
synced 2026-04-04 20:13:01 +00:00
go baby go
This commit is contained in:
14
go-garth/garth/testutils/http.go
Normal file
14
go-garth/garth/testutils/http.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package testutils
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
)
|
||||
|
||||
func MockJSONResponse(code int, body string) *httptest.Server {
|
||||
return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(code)
|
||||
w.Write([]byte(body))
|
||||
}))
|
||||
}
|
||||
Reference in New Issue
Block a user