feat: add t.Helper to request helper
This commit is contained in:
		@ -4,6 +4,7 @@ import (
 | 
			
		||||
	"io"
 | 
			
		||||
	"net/http"
 | 
			
		||||
	"net/http/httptest"
 | 
			
		||||
	"testing"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type Header struct {
 | 
			
		||||
@ -12,11 +13,13 @@ type Header struct {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func PerformRequest(
 | 
			
		||||
	t testing.TB,
 | 
			
		||||
	r http.Handler,
 | 
			
		||||
	method, path string,
 | 
			
		||||
	body io.Reader,
 | 
			
		||||
	headers ...Header,
 | 
			
		||||
) *httptest.ResponseRecorder {
 | 
			
		||||
	t.Helper()
 | 
			
		||||
	req := httptest.NewRequest(method, path, body)
 | 
			
		||||
	for _, h := range headers {
 | 
			
		||||
		req.Header.Add(h.Key, h.Value)
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user