Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tinyhttp/accepts

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tinyhttp/accepts - npm Package Compare versions

Comparing version 2.0.9 to 2.1.0

2

dist/index.d.ts
import Negotiator from 'negotiator';
import { IncomingMessage as I, IncomingHttpHeaders } from 'http';
import { IncomingMessage as I, IncomingHttpHeaders } from 'node:http';
export declare class Accepts {

@@ -4,0 +4,0 @@ headers: IncomingHttpHeaders;

{
"name": "@tinyhttp/accepts",
"description": "accepts rewrite in TypeScript",
"version": "2.0.9",
"version": "2.1.0",
"license": "MIT",

@@ -17,3 +17,3 @@ "homepage": "https://tinyhttp.v1rtl.site",

"engines": {
"node": ">=12.4.0"
"node": ">=12.20.0"
},

@@ -20,0 +20,0 @@ "type": "module",

@@ -5,9 +5,11 @@ # @tinyhttp/accepts

Higher level content negotiation based on [negotiator](https://www.npmjs.com/package/negotiator).
Extracted from [koa](https://www.npmjs.com/package/koa) for general use.
Higher level content negotiation based on
[negotiator](https://www.npmjs.com/package/negotiator). Extracted from
[koa](https://www.npmjs.com/package/koa) for general use.
In addition to negotiator, it allows:
- Allows types as an array or arguments list, ie `(['text/html', 'application/json'])`
as well as `('text/html', 'application/json')`.
- Allows types as an array or arguments list, ie
`(['text/html', 'application/json'])` as well as
`('text/html', 'application/json')`.
- Allows type shorthands such as `json`.

@@ -35,4 +37,4 @@ - Returns `false` when no types match

Return the first accepted charset. If nothing in `charsets` is accepted,
then `false` is returned.
Return the first accepted charset. If nothing in `charsets` is accepted, then
`false` is returned.

@@ -46,4 +48,4 @@ #### `.charsets()`

Return the first accepted encoding. If nothing in `encodings` is accepted,
then `false` is returned.
Return the first accepted encoding. If nothing in `encodings` is accepted, then
`false` is returned.

@@ -57,4 +59,4 @@ #### `.encodings()`

Return the first accepted language. If nothing in `languages` is accepted,
then `false` is returned.
Return the first accepted language. If nothing in `languages` is accepted, then
`false` is returned.

@@ -72,4 +74,4 @@ #### `.languages()`

The `types` array can contain full MIME types or file extensions. Any value
that is not a full MIME types is passed to `require('mime-types').lookup`.
The `types` array can contain full MIME types or file extensions. Any value that
is not a full MIME types is passed to `require('mime-types').lookup`.

@@ -90,3 +92,3 @@ #### `.types()`

import Accepts from '@tinyhttp/accepts'
import { createServer } from 'http'
import { createServer } from 'node:http'

@@ -93,0 +95,0 @@ createServer((req, res) => {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc