mirror of
https://github.com/cubixle/ebay.git
synced 2026-04-30 03:28:41 +01:00
add first test
This commit is contained in:
@@ -3,6 +3,7 @@ package ebay
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@@ -76,6 +77,9 @@ type Opt func(*http.Request)
|
||||
// NewRequest creates an API request.
|
||||
// url should always be specified without a preceding slash.
|
||||
func (c *Client) NewRequest(method, url string, opts ...Opt) (*http.Request, error) {
|
||||
if strings.HasPrefix(url, "/") {
|
||||
return nil, errors.New("url should always be specified without a preceding slash")
|
||||
}
|
||||
u, err := c.baseURL.Parse(url)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user