cactus / go-camo

A secure image proxy server
MIT License
254 stars 48 forks source link

proxy: Split out exception for missing content types #32

Closed jacobbednarz closed 5 years ago

jacobbednarz commented 5 years ago

This takes the current logic for checking whether the request is for a valid HTTP content-type and splits it into two parts. The split moves to allow differentiation between a content-type that we don't intend to proxy and a missing content-type as they should be handled differently.

jacobbednarz commented 5 years ago

Looks like at least one of these failures is also happening on master.

$ make test
Running tests...
?       github.com/cactus/go-camo/cmd/go-camo   [no test files]
?       github.com/cactus/go-camo/cmd/url-tool  [no test files]
--- FAIL: Test404ImageLargerThan5MB (3.19s)
        Error Trace:    proxy_test.go:217
        Error:          Expected nil, but got: &errors.errorString{s:"response code = 504, wanted 404"}
        Test:           Test404ImageLargerThan5MB
FAIL
FAIL    github.com/cactus/go-camo/pkg/camo  11.278s
ok      github.com/cactus/go-camo/pkg/camo/encoding (cached)
ok      github.com/cactus/go-camo/pkg/router    (cached)
ok      github.com/cactus/go-camo/pkg/stats (cached)
make: *** [test] Error 1
dropwhile commented 5 years ago

The tests currently rely on a few public servers for a couple of tests. A few of those tests sometimes fail, when the server it tests against breaks or has errors. I'll look into this one in particular and see if the test needs to be adjusted.

dropwhile commented 5 years ago

lgtm. Thanks!