Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tennashi/reqtest
HTTP handlers for testing HTTP requests
https://github.com/tennashi/reqtest
Last synced: 22 days ago
JSON representation
HTTP handlers for testing HTTP requests
- Host: GitHub
- URL: https://github.com/tennashi/reqtest
- Owner: tennashi
- License: mit
- Created: 2022-01-09T07:49:37.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-07-08T04:17:48.000Z (over 2 years ago)
- Last Synced: 2024-11-25T00:33:03.968Z (28 days ago)
- Language: Go
- Size: 11.7 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# reqtest
HTTP handlers for testing HTTP requests[![Go Reference](https://pkg.go.dev/badge/github.com/tennashi/reqtest.svg)](https://pkg.go.dev/github.com/tennashi/reqtest)
[![CI](https://github.com/tennashi/reqtest/workflows/test/badge.svg)](https://github.com/tennashi/reqtest/actions)## Usage
```go
package reqtest_testimport (
"net/http"
"net/http/httptest"
"testing""github.com/tennashi/reqtest"
)func TestSomeRequest(t *testing.T) {
srv := httptest.NewServer(reqtest.CompareMethodHandler(t, "GET"))
defer srv.Close()res, err := http.Get(srv.URL)
if err != nil {
t.Fatal(err)
}
defer res.Body.Close()
}
```