|
|
@ -225,6 +225,23 @@ func TestNewRequest_emptyUserAgent(t *testing.T) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// If a nil body is passed to github.NewRequest, make sure that nil is also
|
|
|
|
|
|
// passed to http.NewRequest. In most cases, passing in io.Reader the returns
|
|
|
|
|
|
// no content is fine, since there is no difference between an HTTP request
|
|
|
|
|
|
// body that is an empty string versus one that is not set at all. However in
|
|
|
|
|
|
// certain cases, intermediate systems may treat these differently resulting in
|
|
|
|
|
|
// subtle errors.
|
|
|
|
|
|
func TestNewRequest_emptyBody(t *testing.T) { |
|
|
|
|
|
c := NewClient(nil) |
|
|
|
|
|
req, err := c.NewRequest("GET", "/", nil) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
t.Fatalf("NewRequest returned unexpected error: %v", err) |
|
|
|
|
|
} |
|
|
|
|
|
if req.Body != nil { |
|
|
|
|
|
t.Fatalf("constructed request contains a non-nil Body") |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
func TestResponse_populatePageValues(t *testing.T) { |
|
|
func TestResponse_populatePageValues(t *testing.T) { |
|
|
r := http.Response{ |
|
|
r := http.Response{ |
|
|
Header: http.Header{ |
|
|
Header: http.Header{ |
|
|
|