     ///
     /// - Parameter newWrittenDataFilter: The new written data filter
     public func setWrittenDataFilter(_ newWrittenDataFilter: WrittenDataFilter) -> WrittenDataFilter {
-        let oldWrittenDataFilter = writtenDataFilter
-        writtenDataFilter = newWrittenDataFilter
+        let oldWrittenDataFilter = lifecycle.writtenDataFilter
+        lifecycle.writtenDataFilter = newWrittenDataFilter
         return oldWrittenDataFilter
     }
 

        var invokedSend = false
    }

    ///
    /// The server response
    ///

    @discardableResult
    public func end() throws {

        lifecycle.onEndInvoked()

        // Sets status code if unset
        if statusCode == .unknown {
