Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

17 lines (14 sloc) 0.408 kb
package mockhttp
import (
"io"
"net/http"
"testing"
)
// NewRequest is like http.NewRequest, but calls t.Fatal on error.
func NewRequest(t testing.TB, method, url string, body io.Reader) *http.Request {
req, err := http.NewRequest(method, url, body)
if err != nil {
t.Fatalf("Bug in test: cannot construct http.Request from method=%q, url=%q, body=%#v: %s", method, url, body, err)
}
return req
}
Jump to Line
Something went wrong with that request. Please try again.