diff --git a/api/handler/handlers_test.go b/api/handler/handlers_test.go index 495c2683a..3137652dd 100644 --- a/api/handler/handlers_test.go +++ b/api/handler/handlers_test.go @@ -130,7 +130,7 @@ func prepareTestRequest(t *testing.T, bktName, objName string, body interface{}) require.NoError(t, err) w := httptest.NewRecorder() - r := httptest.NewRequest(http.MethodPut, defaultUrl, bytes.NewReader(rawBody)) + r := httptest.NewRequest(http.MethodPut, defaultURL, bytes.NewReader(rawBody)) reqInfo := api.NewReqInfo(w, r, api.ObjectRequest{Bucket: bktName, Object: objName}) r = r.WithContext(api.SetReqInfo(r.Context(), reqInfo)) diff --git a/api/handler/locking_test.go b/api/handler/locking_test.go index 754c0dbd2..07c066182 100644 --- a/api/handler/locking_test.go +++ b/api/handler/locking_test.go @@ -17,7 +17,7 @@ import ( "github.com/stretchr/testify/require" ) -const defaultUrl = "http://localhost/" +const defaultURL = "http://localhost/" func TestFormObjectLock(t *testing.T) { for _, tc := range []struct { @@ -63,7 +63,7 @@ func TestFormObjectLock(t *testing.T) { name: "invalid time format error", bktInfo: &data.BucketInfo{ObjectLockEnabled: true}, header: map[string][]string{ - api.AmzObjectLockRetainUntilDate: {time.Now().Format(time.Layout)}, + api.AmzObjectLockRetainUntilDate: {time.Now().Format(time.RFC822)}, }, expectedError: true, }, @@ -351,7 +351,7 @@ func TestPutBucketLockConfigurationHandler(t *testing.T) { require.NoError(t, err) w := httptest.NewRecorder() - r := httptest.NewRequest(http.MethodPut, defaultUrl, bytes.NewReader(body)) + r := httptest.NewRequest(http.MethodPut, defaultURL, bytes.NewReader(body)) r = r.WithContext(api.SetReqInfo(r.Context(), api.NewReqInfo(w, r, api.ObjectRequest{Bucket: tc.bucket}))) hc.Handler().PutBucketObjectLockConfigHandler(w, r) @@ -425,7 +425,7 @@ func TestGetBucketLockConfigurationHandler(t *testing.T) { } { t.Run(tc.name, func(t *testing.T) { w := httptest.NewRecorder() - r := httptest.NewRequest(http.MethodPut, defaultUrl, bytes.NewReader(nil)) + r := httptest.NewRequest(http.MethodPut, defaultURL, bytes.NewReader(nil)) r = r.WithContext(api.SetReqInfo(r.Context(), api.NewReqInfo(w, r, api.ObjectRequest{Bucket: tc.bucket}))) hc.Handler().GetBucketObjectLockConfigHandler(w, r) diff --git a/api/layer/versioning.go b/api/layer/versioning.go index cbffd4e47..9bebe362b 100644 --- a/api/layer/versioning.go +++ b/api/layer/versioning.go @@ -398,18 +398,6 @@ func contains(list []string, elem string) bool { return false } -func objectInfoToBucketSettings(info *data.ObjectInfo) *data.BucketSettings { - res := &data.BucketSettings{} - - enabled, ok := info.Headers[attrSettingsVersioningEnabled] - if ok { - if parsed, err := strconv.ParseBool(enabled); err == nil { - res.VersioningEnabled = parsed - } - } - return res -} - func (n *layer) checkVersionsExist(ctx context.Context, bkt *data.BucketInfo, obj *VersionedObject) (*data.ObjectInfo, error) { versions, err := n.headVersions(ctx, bkt, obj.Name) if err != nil {