Instance Property
accept
Returns a collection of
MediaTypePreferences specified by this HTTP message’s "Accept" header.var accept: [HTTPMediaTypePreference] { get }
Discussion
You can access all MediaTypes in this collection to check membership.
httpReq.headers.accept.mediaTypes.contains(.html)
Or you can compare preferences for two MediaTypes.
let pref = httpReq.headers.accept.comparePreference(for: .json, to: .html)