mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-04-25 04:46:24 +02:00
update allowed func to return error instead of bool
this allows returning a more accurate error message, particularly in the case of an invalid referer header
This commit is contained in:
parent
710a2ab1c9
commit
27d53782b4
2 changed files with 17 additions and 24 deletions
|
|
@ -70,7 +70,7 @@ func TestAllowed(t *testing.T) {
|
|||
t.Errorf("error parsing url %q: %v", tt.url, err)
|
||||
}
|
||||
req := &Request{u, tt.options, tt.request}
|
||||
if got, want := p.allowed(req), tt.allowed; got != want {
|
||||
if got, want := p.allowed(req), tt.allowed; (got == nil) != want {
|
||||
t.Errorf("allowed(%q) returned %v, want %v.\nTest struct: %#v", req, got, want, tt)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue