How to use the @hapi/accept.mediaTypes function in @hapi/accept

To help you get started, we’ve selected a few @hapi/accept examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ybonnefond / stubborn / src / Router.ts View on Github external
function findAcceptTypes(headers: ResponseHeaders) {
  const headerKey = Object.keys(headers).find(name =>
    new RegExp('^accept$', 'i').test(name),
  );

  return 'undefined' === typeof headerKey
    ? []
    : accept.mediaTypes(headers[headerKey]);
}
/**

@hapi/accept

HTTP Accept-* headers parsing

BSD-3-Clause
Latest version published 7 months ago

Package Health Score

81 / 100
Full package analysis