         }
         
         // copy the request and authenticate it. retain the original request for retries
-        var actualRequest = request
+        var actualRequest = decorateRequest(request)
         if authenticated {
             actualRequest = signRequest(request)
         }

        }
    }
    
    // MARK: API Functions
    
    // Fetches the /v1/fee-per-kb endpoint

        return mutableRequest
    }
    
    func decorateRequest(_ request: URLRequest) -> URLRequest {
        var actualRequest = request
        #if Testnet
            let testnet = true
        #else
            let testnet = false
        #endif
        #if Testflight
            let testflight = true
        #else
            let testflight = false
        #endif
        
        actualRequest.setValue("\(testnet ? 1 : 0)", forHTTPHeaderField: "X-Bitcoin-Testnet")
        actualRequest.setValue("\(testflight ? 1 : 0)", forHTTPHeaderField: "X-Testflight")
        return actualRequest
    }
    
    open func dataTaskWithRequest(_ request: URLRequest, authenticated: Bool = false,
                             retryCount: Int = 0, handler: @escaping URLSessionTaskHandler) -> URLSessionDataTask {
        let start = Date()
