MCPcopy
hub / github.com/perkeep/perkeep / TestBaseURL

Function TestBaseURL

pkg/server/app/app_test.go:59–135  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

57}
58
59func TestBaseURL(t *testing.T) {
60 tests := []struct {
61 listen string
62 baseURL string
63 wantBackendURL string
64 }{
65 {
66 listen: ":3179",
67 baseURL: "http://foo.com",
68 wantBackendURL: "http://foo.com:3179/",
69 },
70
71 {
72 listen: "localhost",
73 baseURL: "http://foo.com",
74 wantBackendURL: "http://foo.com:80/",
75 },
76
77 {
78 listen: "localhost",
79 baseURL: "https://foo.com",
80 wantBackendURL: "https://foo.com:443/",
81 },
82
83 {
84 listen: "localhost:3179",
85 baseURL: "http://foo.com",
86 wantBackendURL: "http://foo.com:3179/",
87 },
88
89 {
90 listen: "localhost:3179",
91 baseURL: "https://foo.com",
92 wantBackendURL: "https://foo.com:3179/",
93 },
94
95 {
96 listen: ":3179",
97 baseURL: "http://foo.com:123",
98 wantBackendURL: "http://foo.com:3179/",
99 },
100
101 {
102 listen: "localhost",
103 baseURL: "http://foo.com:123",
104 wantBackendURL: "http://foo.com:80/",
105 },
106
107 {
108 listen: "localhost",
109 baseURL: "https://foo.com:123",
110 wantBackendURL: "https://foo.com:443/",
111 },
112
113 {
114 listen: "localhost:3179",
115 baseURL: "http://foo.com:123",
116 wantBackendURL: "http://foo.com:3179/",

Callers

nothing calls this directly

Calls 2

baseURLFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected