aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdnan Maolood <[email protected]>2021-02-15 17:23:54 -0500
committerAdnan Maolood <[email protected]>2021-02-15 17:23:56 -0500
commit19678ef9346037d7d054a259128efab952509179 (patch)
tree965ec6ae5b6ac03d0e8f2bbf77e5916867ee4b85
parentserver: Rename responder to handler (diff)
downloadgo-gemini-19678ef9346037d7d054a259128efab952509179.tar.xz
go-gemini-19678ef9346037d7d054a259128efab952509179.zip
Remove NewRequestFromURL method
Use a Request struct literal instead.
-rw-r--r--request.go15
1 files changed, 4 insertions, 11 deletions
diff --git a/request.go b/request.go
index 3961b07..99b65a3 100644
--- a/request.go
+++ b/request.go
@@ -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.