Request creation simplified and basic auth test added.

This commit is contained in:
Musab Gültekin
2019-06-17 13:53:34 +03:00
parent a5ec28664d
commit 4177f10de9
4 changed files with 27 additions and 6 deletions

View File

@ -1,6 +1,7 @@
package geziyor
import (
"io"
"net/http"
)
@ -11,3 +12,13 @@ type Request struct {
Rendered bool
Cancelled bool
}
// NewRequest returns a new Request given a method, URL, and optional body.
func NewRequest(method, url string, body io.Reader) (*Request, error) {
req, err := http.NewRequest(method, url, body)
if err != nil {
return nil, err
}
return &Request{Request: req}, nil
}