https://github.com/tennashi/reqtest
HTTP handlers for testing HTTP requests
https://github.com/tennashi/reqtest
Last synced: 2 months 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 (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-07-08T04:17:48.000Z (about 3 years ago)
- Last Synced: 2025-05-13T02:06:41.742Z (2 months ago)
- Language: Go
- Size: 11.7 KB
- Stars: 3
- Watchers: 1
- 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[](https://pkg.go.dev/github.com/tennashi/reqtest)
[](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()
}
```