2017-04-20 20:05:21 +00:00
|
|
|
package testhelpers
|
|
|
|
|
2017-05-09 20:31:16 +00:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
2017-04-20 20:05:21 +00:00
|
|
|
// Intp returns a pointer to the given integer value.
|
|
|
|
func Intp(i int) *int {
|
|
|
|
return &i
|
|
|
|
}
|
2017-05-09 20:31:16 +00:00
|
|
|
|
|
|
|
// MustNewRequest creates a new http get request or panics if it can't
|
|
|
|
func MustNewRequest(method, urlStr string, body io.Reader) *http.Request {
|
|
|
|
request, err := http.NewRequest(method, urlStr, body)
|
|
|
|
if err != nil {
|
|
|
|
panic(fmt.Sprintf("failed to create HTTP %s Request for '%s': %s", method, urlStr, err))
|
|
|
|
}
|
|
|
|
return request
|
|
|
|
}
|