diff --git a/handlers/newObjects.go b/handlers/newObjects.go index 21cd2368..5d3b322e 100644 --- a/handlers/newObjects.go +++ b/handlers/newObjects.go @@ -68,6 +68,7 @@ func (a *RestAPI) NewUploadContainerObject(ctx echo.Context, containerID apiserv // prepares attributes from filtered headers for key, val := range filtered { attribute := object.NewAttribute(key, val) + a.log.Debug("Added attribute", zap.String("key", key), zap.String("value", val)) attributes = append(attributes, *attribute) } @@ -76,6 +77,7 @@ func (a *RestAPI) NewUploadContainerObject(ctx echo.Context, containerID apiserv if _, ok := filtered[object.AttributeContentType]; !ok { if ct := ctx.Request().Header.Get("Content-Type"); len(ct) > 0 { attrContentType := object.NewAttribute(object.AttributeContentType, ct) + a.log.Debug("Added attribute", zap.String("key", object.AttributeContentType), zap.String("value", ct)) attributes = append(attributes, *attrContentType) } } @@ -91,7 +93,9 @@ func (a *RestAPI) NewUploadContainerObject(ctx echo.Context, containerID apiserv return ctx.JSON(http.StatusBadRequest, resp) } - timestamp := object.NewAttribute(object.AttributeTimestamp, strconv.FormatInt(parsedTime.Unix(), 10)) + tsStr := strconv.FormatInt(parsedTime.Unix(), 10) + timestamp := object.NewAttribute(object.AttributeTimestamp, tsStr) + a.log.Debug("Added attribute", zap.String("key", object.AttributeTimestamp), zap.String("value", tsStr)) attributes = append(attributes, *timestamp) } } diff --git a/handlers/objects.go b/handlers/objects.go index a1c996e2..458a3963 100644 --- a/handlers/objects.go +++ b/handlers/objects.go @@ -460,9 +460,8 @@ func (a *RestAPI) getByAddress(ctx echo.Context, addr oid.Address, downloadParam } else { contentType = http.DetectContentType(nil) } - - ctx.Response().Header().Set("Content-Type", contentType) } + ctx.Response().Header().Set("Content-Type", contentType) ctx.Response().Header().Set(accessControlAllowOriginHeader, "*") return ctx.Stream(http.StatusOK, contentType, payload) @@ -541,9 +540,8 @@ func (a *RestAPI) headByAddress(ctx echo.Context, addr oid.Address, downloadPara } else { contentType = http.DetectContentType(nil) } - - ctx.Response().Header().Set("Content-Type", contentType) } + ctx.Response().Header().Set("Content-Type", contentType) return nil } diff --git a/handlers/util.go b/handlers/util.go index ff8ef10d..cdbdb960 100644 --- a/handlers/util.go +++ b/handlers/util.go @@ -377,7 +377,7 @@ func filterAttributes(logger *zap.Logger, attributes map[string]string) map[stri delete(attributes, key) continue } - logger.Debug("Added attribute to result object", zap.String("key", key), zap.String("value", value)) + logger.Debug("Filtered attribute", zap.String("key", key), zap.String("value", value)) } return attributes }