MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / TestRedenormalizePathHTTPProtocol

Method TestRedenormalizePathHTTPProtocol

handlers/path_test.go:122–196  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

120}
121
122func (s *PathTestSuite) TestRedenormalizePathHTTPProtocol() {
123 testCases := []struct {
124 name string
125 input string
126 expected string
127 }{
128 {
129 name: "HTTP",
130 input: "plain/http:/example.com/image.jpg",
131 expected: "plain/http://example.com/image.jpg",
132 },
133 {
134 name: "HTTPS",
135 input: "plain/https:/example.com/image.jpg",
136 expected: "plain/https://example.com/image.jpg",
137 },
138 {
139 name: "Local",
140 input: "plain/local:/image.jpg",
141 expected: "plain/local:///image.jpg",
142 },
143 {
144 name: "WithOptions",
145 input: "/rs:fill:300:200/plain/http:/example.com/image.jpg",
146 expected: "rs:fill:300:200/plain/http://example.com/image.jpg",
147 },
148 {
149 name: "NormalizedPath",
150 input: "/plain/http://example.com/image.jpg",
151 expected: "plain/http://example.com/image.jpg",
152 },
153 {
154 name: "ProtocolMissing",
155 input: "/rs:fill:300:200/plain/example.com/image.jpg",
156 expected: "rs:fill:300:200/plain/example.com/image.jpg",
157 },
158 {
159 name: "EmptyString",
160 input: "",
161 expected: "",
162 },
163 {
164 name: "SingleSlash",
165 input: "/",
166 expected: "",
167 },
168 {
169 name: "NoPlainPrefix",
170 input: "/http:/example.com/image.jpg",
171 expected: "http:/example.com/image.jpg",
172 },
173 {
174 name: "NoProtocol",
175 input: "/plain/example.com/image.jpg",
176 expected: "plain/example.com/image.jpg",
177 },
178 {
179 name: "EndsWithProtocol",

Callers

nothing calls this directly

Calls 2

RedenormalizePathFunction · 0.92
RunMethod · 0.80

Tested by

no test coverage detected