mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-04-26 05:16:25 +02:00
accept "fit" option
this also relaxes option parsing to never return an error. In cases where options are not able to be parsed, they are silently ignored.
This commit is contained in:
parent
805aa606ca
commit
2794d47390
4 changed files with 47 additions and 23 deletions
|
|
@ -30,11 +30,15 @@ func TestNewRequest(t *testing.T) {
|
|||
{
|
||||
"http://localhost//ftp://example.com/foo", "", nil, true,
|
||||
},
|
||||
|
||||
// invalid options. These won't return errors, but will not fully parse the options
|
||||
{
|
||||
"http://localhost/s/http://example.com/", "", nil, true,
|
||||
"http://localhost/s/http://example.com/",
|
||||
"http://example.com/", emptyOptions, false,
|
||||
},
|
||||
{
|
||||
"http://localhost/1xs/http://example.com/", "", nil, true,
|
||||
"http://localhost/1xs/http://example.com/",
|
||||
"http://example.com/", &data.Options{Width: 1}, false,
|
||||
},
|
||||
|
||||
// valid URLs
|
||||
|
|
@ -66,15 +70,23 @@ func TestNewRequest(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"http://localhost/1x/http://example.com/",
|
||||
"http://example.com/", &data.Options{1, 0}, false,
|
||||
"http://example.com/", &data.Options{1, 0, false}, false,
|
||||
},
|
||||
{
|
||||
"http://localhost/x1/http://example.com/",
|
||||
"http://example.com/", &data.Options{0, 1}, false,
|
||||
"http://example.com/", &data.Options{0, 1, false}, false,
|
||||
},
|
||||
{
|
||||
"http://localhost/1x2/http://example.com/",
|
||||
"http://example.com/", &data.Options{1, 2}, false,
|
||||
"http://example.com/", &data.Options{1, 2, false}, false,
|
||||
},
|
||||
{
|
||||
"http://localhost/,fit/http://example.com/",
|
||||
"http://example.com/", &data.Options{0, 0, true}, false,
|
||||
},
|
||||
{
|
||||
"http://localhost/1x2,fit/http://example.com/",
|
||||
"http://example.com/", &data.Options{1, 2, true}, false,
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue