Instance Propertyvapor 4.114.1Vapor->NIOHTTP1

accept

Returns a collection of MediaTypePreferences specified by this HTTP message’s "Accept" header.

HTTPHeaders.swift:30
var accept: [HTTPMediaTypePreference] { get }

You can access all MediaTypes in this collection to check membership.

httpReq.accept.mediaTypes.contains(.html)

Or you can compare preferences for two MediaTypes.

let pref = httpReq.accept.comparePreference(for: .json, to: .html)