mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-09-30 14:06:48 +02:00
Fix linter warnings
This commit is contained in:
@@ -412,7 +412,7 @@ func (s *ProcessingHandlerTestSuite) TestETagReqNoIfNotModified() {
|
||||
poStr, imgdata, etag := s.sampleETagData("loremipsumdolor")
|
||||
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
|
||||
s.Require().Empty(r.Header.Get("If-None-Match"))
|
||||
s.Empty(r.Header.Get("If-None-Match"))
|
||||
|
||||
rw.Header().Set("ETag", imgdata.Headers["ETag"])
|
||||
rw.WriteHeader(200)
|
||||
@@ -433,7 +433,7 @@ func (s *ProcessingHandlerTestSuite) TestETagDataNoIfNotModified() {
|
||||
poStr, imgdata, etag := s.sampleETagData("")
|
||||
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
|
||||
s.Require().Empty(r.Header.Get("If-None-Match"))
|
||||
s.Empty(r.Header.Get("If-None-Match"))
|
||||
|
||||
rw.WriteHeader(200)
|
||||
rw.Write(imgdata.Data)
|
||||
@@ -453,7 +453,7 @@ func (s *ProcessingHandlerTestSuite) TestETagReqMatch() {
|
||||
poStr, imgdata, etag := s.sampleETagData(`"loremipsumdolor"`)
|
||||
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
|
||||
s.Require().Equal(imgdata.Headers["ETag"], r.Header.Get("If-None-Match"))
|
||||
s.Equal(imgdata.Headers["ETag"], r.Header.Get("If-None-Match"))
|
||||
|
||||
rw.WriteHeader(304)
|
||||
}))
|
||||
@@ -475,7 +475,7 @@ func (s *ProcessingHandlerTestSuite) TestETagDataMatch() {
|
||||
poStr, imgdata, etag := s.sampleETagData("")
|
||||
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
|
||||
s.Require().Empty(r.Header.Get("If-None-Match"))
|
||||
s.Empty(r.Header.Get("If-None-Match"))
|
||||
|
||||
rw.WriteHeader(200)
|
||||
rw.Write(imgdata.Data)
|
||||
@@ -499,7 +499,7 @@ func (s *ProcessingHandlerTestSuite) TestETagReqNotMatch() {
|
||||
_, _, expectedETag := s.sampleETagData(`"loremipsum"`)
|
||||
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
|
||||
s.Require().Equal(`"loremipsum"`, r.Header.Get("If-None-Match"))
|
||||
s.Equal(`"loremipsum"`, r.Header.Get("If-None-Match"))
|
||||
|
||||
rw.Header().Set("ETag", imgdata.Headers["ETag"])
|
||||
rw.WriteHeader(200)
|
||||
@@ -525,7 +525,7 @@ func (s *ProcessingHandlerTestSuite) TestETagDataNotMatch() {
|
||||
expectedETag := actualETag[:strings.IndexByte(actualETag, '/')] + "/Dasdbefj"
|
||||
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
|
||||
s.Require().Empty(r.Header.Get("If-None-Match"))
|
||||
s.Empty(r.Header.Get("If-None-Match"))
|
||||
|
||||
rw.WriteHeader(200)
|
||||
rw.Write(imgdata.Data)
|
||||
@@ -550,7 +550,7 @@ func (s *ProcessingHandlerTestSuite) TestETagProcessingOptionsNotMatch() {
|
||||
expectedETag := "abcdefj" + actualETag[strings.IndexByte(actualETag, '/'):]
|
||||
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
|
||||
s.Require().Empty(r.Header.Get("If-None-Match"))
|
||||
s.Empty(r.Header.Get("If-None-Match"))
|
||||
|
||||
rw.Header().Set("ETag", imgdata.Headers["ETag"])
|
||||
rw.WriteHeader(200)
|
||||
@@ -604,7 +604,7 @@ func (s *ProcessingHandlerTestSuite) TestModifiedSinceReqExactMatchLastModifiedD
|
||||
lastModified := "Wed, 21 Oct 2015 07:28:00 GMT"
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
|
||||
modifiedSince := r.Header.Get("If-Modified-Since")
|
||||
s.Require().Empty(modifiedSince)
|
||||
s.Empty(modifiedSince)
|
||||
rw.WriteHeader(200)
|
||||
rw.Write(data)
|
||||
}))
|
||||
@@ -623,7 +623,7 @@ func (s *ProcessingHandlerTestSuite) TestModifiedSinceReqExactMatchLastModifiedE
|
||||
lastModified := "Wed, 21 Oct 2015 07:28:00 GMT"
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
|
||||
modifiedSince := r.Header.Get("If-Modified-Since")
|
||||
s.Require().Equal(lastModified, modifiedSince)
|
||||
s.Equal(lastModified, modifiedSince)
|
||||
rw.WriteHeader(304)
|
||||
}))
|
||||
defer ts.Close()
|
||||
@@ -641,7 +641,7 @@ func (s *ProcessingHandlerTestSuite) TestModifiedSinceReqCompareMoreRecentLastMo
|
||||
config.LastModifiedEnabled = false
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
|
||||
modifiedSince := r.Header.Get("If-Modified-Since")
|
||||
s.Require().Empty(modifiedSince)
|
||||
s.Empty(modifiedSince)
|
||||
rw.WriteHeader(200)
|
||||
rw.Write(data)
|
||||
}))
|
||||
@@ -663,8 +663,8 @@ func (s *ProcessingHandlerTestSuite) TestModifiedSinceReqCompareMoreRecentLastMo
|
||||
fileLastModified, _ := time.Parse(http.TimeFormat, "Wed, 21 Oct 2015 07:28:00 GMT")
|
||||
modifiedSince := r.Header.Get("If-Modified-Since")
|
||||
parsedModifiedSince, err := time.Parse(http.TimeFormat, modifiedSince)
|
||||
s.Require().NoError(err)
|
||||
s.Require().True(fileLastModified.Before(parsedModifiedSince))
|
||||
s.NoError(err)
|
||||
s.True(fileLastModified.Before(parsedModifiedSince))
|
||||
rw.WriteHeader(304)
|
||||
}))
|
||||
defer ts.Close()
|
||||
@@ -684,7 +684,7 @@ func (s *ProcessingHandlerTestSuite) TestModifiedSinceReqCompareTooOldLastModifi
|
||||
data := s.readTestFile("test1.png")
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
|
||||
modifiedSince := r.Header.Get("If-Modified-Since")
|
||||
s.Require().Empty(modifiedSince)
|
||||
s.Empty(modifiedSince)
|
||||
rw.WriteHeader(200)
|
||||
rw.Write(data)
|
||||
}))
|
||||
@@ -707,8 +707,8 @@ func (s *ProcessingHandlerTestSuite) TestModifiedSinceReqCompareTooOldLastModifi
|
||||
fileLastModified, _ := time.Parse(http.TimeFormat, "Wed, 21 Oct 2015 07:28:00 GMT")
|
||||
modifiedSince := r.Header.Get("If-Modified-Since")
|
||||
parsedModifiedSince, err := time.Parse(http.TimeFormat, modifiedSince)
|
||||
s.Require().NoError(err)
|
||||
s.Require().True(fileLastModified.After(parsedModifiedSince))
|
||||
s.NoError(err)
|
||||
s.True(fileLastModified.After(parsedModifiedSince))
|
||||
rw.WriteHeader(200)
|
||||
rw.Write(data)
|
||||
}))
|
||||
|
Reference in New Issue
Block a user