import { FORMAT_TO_MIME_TYPE } from './select-output-type.js';
export function isExplicitAcceptHeader(headers) {
    const incomingAcceptHeader = headers.get('accept');
    if (incomingAcceptHeader == null) {
        return false;
    }
    return Object.values(FORMAT_TO_MIME_TYPE)
        .some(mimeType => incomingAcceptHeader.includes(mimeType));
}
export function isExplicitFormatQuery(query) {
    const formatQuery = query?.format;
    if (formatQuery != null && Object.keys(FORMAT_TO_MIME_TYPE).includes(formatQuery)) {
        return true;
    }
    return false;
}
/**
 * The user can provide an explicit `accept` header in the request headers or a
 * `format` query parameter in the URL.
 *
 * If either of these are provided, this function returns true.
 */
export function isExplicitIpldAcceptRequest({ query, headers }) {
    return isExplicitAcceptHeader(headers) || isExplicitFormatQuery(query);
}
//# sourceMappingURL=is-accept-explicit.js.map