mirror of
https://git.sr.ht/~adnano/go-gemini
synced 2024-05-29 23:16:06 +02:00
Remove NewRequestFromURL method
Use a Request struct literal instead.
This commit is contained in:
parent
5a784693ef
commit
19678ef934
15
request.go
15
request.go
|
@ -62,22 +62,15 @@ type Request struct {
|
||||||
// NewRequest returns a new request.
|
// NewRequest returns a new request.
|
||||||
//
|
//
|
||||||
// The returned Request is suitable for use with Client.Do.
|
// 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) {
|
func NewRequest(rawurl string) (*Request, error) {
|
||||||
u, err := url.Parse(rawurl)
|
u, err := url.Parse(rawurl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return NewRequestFromURL(u), nil
|
return &Request{URL: 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,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReadRequest reads and parses an incoming request from r.
|
// ReadRequest reads and parses an incoming request from r.
|
||||||
|
|
Loading…
Reference in New Issue