1
0
Fork 0
mirror of https://git.sr.ht/~adnano/go-gemini synced 2024-05-13 23:56:05 +02:00

Remove NewRequestFromURL method

Use a Request struct literal instead.
This commit is contained in:
Adnan Maolood 2021-02-15 17:23:54 -05:00
parent 5a784693ef
commit 19678ef934

View File

@ -62,22 +62,15 @@ type Request struct {
// NewRequest returns a new request.
//
// The returned Request is suitable for use with Client.Do.
//
// Callers should be careful that the URL query is properly escaped.
// See the documentation for QueryEscape for more information.
func NewRequest(rawurl string) (*Request, error) {
u, err := url.Parse(rawurl)
if err != nil {
return nil, err
}
return NewRequestFromURL(u), nil
}
// NewRequestFromURL returns a new request for the given URL.
//
// Callers should be careful that the URL query is properly escaped.
// See the documentation for QueryEscape for more information.
func NewRequestFromURL(url *url.URL) *Request {
return &Request{
URL: url,
}
return &Request{URL: u}, nil
}
// ReadRequest reads and parses an incoming request from r.