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

Method TestDownloadInvalidImage

imagedata/image_data_test.go:225–235  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

223}
224
225func (s *ImageDataTestSuite) TestDownloadInvalidImage() {
226 s.testServer().SetBody([]byte("invalid"))
227
228 imgdata, _, err := s.factory().DownloadSync(
229 context.Background(), s.testServer().URL(), "Test image", imagedata.DownloadOptions{},
230 )
231
232 s.Require().Error(err)
233 s.Require().Equal(http.StatusUnprocessableEntity, errctx.Wrap(err).StatusCode())
234 s.Require().Nil(imgdata)
235}
236
237func (s *ImageDataTestSuite) TestDownloadSourceAddressNotAllowed() {
238 s.fetcherCfg().Transport.HTTP.AllowLoopbackSourceAddresses = false

Callers

nothing calls this directly

Calls 7

WrapFunction · 0.92
SetBodyMethod · 0.80
DownloadSyncMethod · 0.80
BackgroundMethod · 0.80
ErrorMethod · 0.65
StatusCodeMethod · 0.65
URLMethod · 0.45

Tested by

no test coverage detected