MCPcopy Index your code
hub / github.com/google/go-github / TestNewRequest_emptyBody

Function TestNewRequest_emptyBody

github/github_test.go:1645–1655  ·  view source on GitHub ↗

If a nil body is passed to github.NewRequest, make sure that nil is also passed to http.NewRequest. In most cases, passing an io.Reader that 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 cer

(t *testing.T)

Source from the content-addressed store, hash-verified

1643// certain cases, intermediate systems may treat these differently resulting in
1644// subtle errors.
1645func TestNewRequest_emptyBody(t *testing.T) {
1646 t.Parallel()
1647 c := mustNewClient(t)
1648 req, err := c.NewRequest(t.Context(), "GET", ".", nil)
1649 if err != nil {
1650 t.Fatalf("NewRequest returned unexpected error: %v", err)
1651 }
1652 if req.Body != nil {
1653 t.Fatal("constructed request contains a non-nil Body")
1654 }
1655}
1656
1657func TestNewRequest_errorForNoTrailingSlash(t *testing.T) {
1658 t.Parallel()

Callers

nothing calls this directly

Calls 2

mustNewClientFunction · 0.85
NewRequestMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…