diff --git a/api/middleware/reqinfo.go b/api/middleware/reqinfo.go index b7f53c26..3f81dc6d 100644 --- a/api/middleware/reqinfo.go +++ b/api/middleware/reqinfo.go @@ -41,7 +41,6 @@ type ( Namespace string User string // User owner id Tagging *data.Tagging - tags []KeyVal // Any additional info not accommodated by above fields } // ObjectRequest represents object request data. @@ -103,50 +102,6 @@ func NewReqInfo(w http.ResponseWriter, r *http.Request, req ObjectRequest, sourc return reqInfo } -// AppendTags -- appends key/val to ReqInfo.tags. -func (r *ReqInfo) AppendTags(key string, val string) *ReqInfo { - if r == nil { - return nil - } - r.Lock() - defer r.Unlock() - r.tags = append(r.tags, KeyVal{key, val}) - return r -} - -// SetTags -- sets key/val to ReqInfo.tags. -func (r *ReqInfo) SetTags(key string, val string) *ReqInfo { - if r == nil { - return nil - } - r.Lock() - defer r.Unlock() - // Search for a tag key already existing in tags - var updated bool - for _, tag := range r.tags { - if tag.Key == key { - tag.Val = val - updated = true - break - } - } - if !updated { - // Append to the end of tags list - r.tags = append(r.tags, KeyVal{key, val}) - } - return r -} - -// GetTags -- returns the user defined tags. -func (r *ReqInfo) GetTags() []KeyVal { - if r == nil { - return nil - } - r.RLock() - defer r.RUnlock() - return append([]KeyVal(nil), r.tags...) -} - // GetRequestID returns the request ID from the response writer or the context. func GetRequestID(v interface{}) string { switch t := v.(type) { diff --git a/api/middleware/response.go b/api/middleware/response.go index 54f5b2ff..085a97c7 100644 --- a/api/middleware/response.go +++ b/api/middleware/response.go @@ -201,18 +201,6 @@ func EncodeResponse(response interface{}) ([]byte, error) { return bytesBuffer.Bytes(), nil } -// EncodeResponseNoHeader encodes response without setting xml.Header. -// Should be used with periodicXMLWriter which sends xml.Header to the client -// with whitespaces to keep connection alive. -func EncodeResponseNoHeader(response interface{}) ([]byte, error) { - var bytesBuffer bytes.Buffer - if err := xml.NewEncoder(&bytesBuffer).Encode(response); err != nil { - return nil, err - } - - return bytesBuffer.Bytes(), nil -} - // EncodeToResponse encodes the response into ResponseWriter. func EncodeToResponse(w http.ResponseWriter, response interface{}) error { w.WriteHeader(http.StatusOK)