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

Method TestHandlerBasicRequest

handlers/stream/handler_test.go:167–182  ·  view source on GitHub ↗

TestHandlerBasicRequest checks basic streaming request

()

Source from the content-addressed store, hash-verified

165
166// TestHandlerBasicRequest checks basic streaming request
167func (s *HandlerTestSuite) TestHandlerBasicRequest() {
168 data := s.testData.Read("test1.png")
169
170 s.testServer().SetHeaders(httpheaders.ContentType, "image/png").SetBody(data)
171
172 res := s.execute("", nil, options.New())
173 defer res.Body.Close()
174
175 s.Require().Equal(200, res.StatusCode)
176 s.Require().Equal("image/png", res.Header.Get(httpheaders.ContentType))
177
178 // Verify we get the original image data
179 actual, err := io.ReadAll(res.Body)
180 s.Require().NoError(err)
181 s.Require().Equal(data, actual)
182}
183
184// TestHandlerResponseHeadersPassthrough checks that original response headers are
185// passed through to the client

Callers

nothing calls this directly

Calls 7

executeMethod · 0.95
NewFunction · 0.92
SetBodyMethod · 0.80
SetHeadersMethod · 0.80
CloseMethod · 0.65
GetMethod · 0.65
ReadMethod · 0.45

Tested by

no test coverage detected