mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-10-11 12:42:29 +02:00
Add support for client hints prefixed with Sec-CH-; Remove Viewport-Width header support
This commit is contained in:
@@ -439,40 +439,6 @@ func (s *ProcessingOptionsTestSuite) TestParsePathWidthHeaderRedefine() {
|
||||
require.Equal(s.T(), 150, po.Width)
|
||||
}
|
||||
|
||||
func (s *ProcessingOptionsTestSuite) TestParsePathViewportWidthHeader() {
|
||||
config.EnableClientHints = true
|
||||
|
||||
path := "/plain/http://images.dev/lorem/ipsum.jpg@png"
|
||||
headers := http.Header{"Viewport-Width": []string{"100"}}
|
||||
po, _, err := ParsePath(path, headers)
|
||||
|
||||
require.Nil(s.T(), err)
|
||||
|
||||
require.Equal(s.T(), 100, po.Width)
|
||||
}
|
||||
|
||||
func (s *ProcessingOptionsTestSuite) TestParsePathViewportWidthHeaderDisabled() {
|
||||
path := "/plain/http://images.dev/lorem/ipsum.jpg@png"
|
||||
headers := http.Header{"Viewport-Width": []string{"100"}}
|
||||
po, _, err := ParsePath(path, headers)
|
||||
|
||||
require.Nil(s.T(), err)
|
||||
|
||||
require.Equal(s.T(), 0, po.Width)
|
||||
}
|
||||
|
||||
func (s *ProcessingOptionsTestSuite) TestParsePathViewportWidthHeaderRedefine() {
|
||||
config.EnableClientHints = true
|
||||
|
||||
path := "/width:150/plain/http://images.dev/lorem/ipsum.jpg@png"
|
||||
headers := http.Header{"Viewport-Width": []string{"100"}}
|
||||
po, _, err := ParsePath(path, headers)
|
||||
|
||||
require.Nil(s.T(), err)
|
||||
|
||||
require.Equal(s.T(), 150, po.Width)
|
||||
}
|
||||
|
||||
func (s *ProcessingOptionsTestSuite) TestParsePathDprHeader() {
|
||||
config.EnableClientHints = true
|
||||
|
||||
|
Reference in New Issue
Block a user