Skip to content

Instantly share code, notes, and snippets.

@d108
Created January 30, 2018 01:51
Show Gist options
  • Save d108/dc3f35fd619f2e817db9f4ed671fc635 to your computer and use it in GitHub Desktop.
Save d108/dc3f35fd619f2e817db9f4ed671fc635 to your computer and use it in GitHub Desktop.
ResourceTypeDetector.swift code
}
// MARK: Synchronous detectors
open class ResourceTypeDetector: NSObject {
/// There is not very much of them nor big variety in them, so replacing with
/// regexes or adding leading dot in initialization would make the code
/// unnecessarily complicated.
fileprivate struct TypeMatcherDefinition {
var resourceType: WebRequestResourceType // enum reflecting (but not copying) Chrome defined type strings
var mimeStrings: [String] // substrings matched against request header "Accept"
var fileSuffixes: [String] // URL string suffix match. Complete strings with leading dot.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment