         "text/plain": PlainTextBodyDeserializer(),
         "*/html": HTMLBodyDeserializer()
     ]
-    
+
     public class func register() {
         URLProtocol.registerClass(self)
     }
-    
+
     public class func unregister() {
         URLProtocol.unregisterClass(self)
     }
-    
+
     public class func enable(in configuration: URLSessionConfiguration) {
         configuration.protocolClasses?.insert(Sniffer.self, at: 0)
     }
-    
+
     public class func register(deserializer: BodyDeserializer, `for` contentTypes: [String]) {
         for contentType in contentTypes {
             guard contentType.components(separatedBy: "/").count == 2 else { continue }
             bodyDeserializers[contentType] = deserializer
         }
     }
-    
+
     // MARK: - URLProtocol
     open override class func canInit(with request: URLRequest) -> Bool {
         guard let url = request.url, let scheme = url.scheme else { return false }
         return ["http", "https"].contains(scheme) && self.property(forKey: Keys.request, in: request)  == nil
     }
-    
+
     open override class func canonicalRequest(for request: URLRequest) -> URLRequest {
         return request
     }
-    
+
     open override func startLoading() {
         if let _ = urlTask { return }
         guard let urlRequest = (request as NSURLRequest).mutableCopy() as? NSMutableURLRequest , self.urlRequest == nil else { return }
-        
+
         self.urlRequest = urlRequest
-        
+
         Sniffer.setProperty(true, forKey: Keys.request, in: urlRequest)
         Sniffer.setProperty(Date(), forKey: Keys.duration, in: urlRequest)
-        
+
         log(request: urlRequest as URLRequest)
-        
+
         urlTask = session.dataTask(with: request)
         urlTask?.resume()
     }
-    
+
     open override func stopLoading() {
         serialQueue.sync { [weak self] in
             self?.urlTask?.cancel()

            return data as Data
        }
    }
    
    private func find(deserialize contentType: String) -> BodyDeserializer? {
        for (pattern, deserializer) in Sniffer.bodyDeserializers {
            do {
                let regex = try NSRegularExpression(pattern: pattern.replacingOccurrences(of: "*", with: "[a-z]+"))
                let results = regex.matches(in: contentType, range: NSRange(location: 0, length: contentType.count))
                
                if !results.isEmpty {
                    return deserializer
                }

            self?.session.invalidateAndCancel()
        }
    }

    // MARK: - Private

    private func log(_ string: String) {
        if let _ = Sniffer.onLogger {
            Sniffer.onLogger?(string)
