Request creation simplified and basic auth test added.
This commit is contained in:
11
request.go
11
request.go
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user