mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-04-28 14:26:24 +02:00
add support for URL encoding remote URL
Updates #250 Updates #290 Fixes #447 Co-authored-by: Will Norris <will@willnorris.com>
This commit is contained in:
parent
d04e37fc14
commit
2254a1f2ff
3 changed files with 80 additions and 12 deletions
37
data_test.go
37
data_test.go
|
|
@ -177,6 +177,43 @@ func TestNewRequest(t *testing.T) {
|
|||
"http://localhost/http://example.com/%2C",
|
||||
"http://example.com/%2C", emptyOptions, false,
|
||||
},
|
||||
// percent encoded cases
|
||||
{
|
||||
"http://localhost/1x2/http%3A%2F%2Fexample.com%2Ffoo",
|
||||
"http://example.com/foo", Options{Width: 1, Height: 2}, false,
|
||||
},
|
||||
{
|
||||
"http://localhost/1x2/http%3A%2F%2Fexample.com%2Fhttp%2Fstuff",
|
||||
"http://example.com/http/stuff", Options{Width: 1, Height: 2}, false,
|
||||
},
|
||||
{
|
||||
"http://localhost/http%3A%2F%2Fexample.com%2Ffoo",
|
||||
"http://example.com/foo", emptyOptions, false,
|
||||
},
|
||||
{
|
||||
"http://localhost/HTTP%3a%2f%2fexample.com%2Ffoo",
|
||||
"http://example.com/foo", emptyOptions, false,
|
||||
},
|
||||
{
|
||||
"http://localhost/http%3A%2Fexample.com%2Ffoo",
|
||||
"http://example.com/foo", emptyOptions, false,
|
||||
},
|
||||
{
|
||||
"http://localhost/http%3A%2F%2F%2Fexample.com%2Ffoo",
|
||||
"http://example.com/foo", emptyOptions, false,
|
||||
},
|
||||
{
|
||||
"http://localhost//http%3A%2F%2Fexample.com%2Ffoo",
|
||||
"http://example.com/foo", emptyOptions, false,
|
||||
},
|
||||
{
|
||||
"http://localhost/http%3A%2F%2Fexample.com%2Ffoo%3Ftest%3D1%26test%3D2",
|
||||
"http://example.com/foo?test=1&test=2", emptyOptions, false,
|
||||
},
|
||||
{
|
||||
"http://localhost/1x2/http%3A%2F%2Fexample.com%2Ffoo%3Ftest%3D1%26test%3D2",
|
||||
"http://example.com/foo?test=1&test=2", Options{Width: 1, Height: 2}, false,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue