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

Function TestNewFormRequest_errorForNoTrailingSlash

github/github_test.go:1837–1859  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1835}
1836
1837func TestNewFormRequest_errorForNoTrailingSlash(t *testing.T) {
1838 t.Parallel()
1839 tests := []struct {
1840 rawURL string
1841 wantError bool
1842 }{
1843 {rawURL: "https://example.com/api/v3", wantError: true},
1844 {rawURL: "https://example.com/api/v3/", wantError: false},
1845 }
1846 c := mustNewClient(t)
1847 for _, test := range tests {
1848 u, err := url.Parse(test.rawURL)
1849 if err != nil {
1850 t.Fatalf("url.Parse returned unexpected error: %v.", err)
1851 }
1852 c.baseURL = u
1853 if _, err := c.NewFormRequest(t.Context(), "test", nil); test.wantError && err == nil {
1854 t.Fatal("Expected error to be returned.")
1855 } else if !test.wantError && err != nil {
1856 t.Fatalf("NewFormRequest returned unexpected error: %v.", err)
1857 }
1858 }
1859}
1860
1861func TestNewUploadRequest_WithVersion(t *testing.T) {
1862 t.Parallel()

Callers

nothing calls this directly

Calls 2

mustNewClientFunction · 0.85
NewFormRequestMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…