Socket
Socket
Sign inDemoInstall

@tinyhttp/req

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tinyhttp/req - npm Package Compare versions

Comparing version 0.1.7 to 0.1.8

6

CHANGELOG.md
# @tinyhttp/req
## 0.1.8
### Patch Changes
- Add `req.acceptsCharsets` and `req.acceptsEncodings`
## 0.1.7

@@ -4,0 +10,0 @@

4

dist/index.d.ts
import { IncomingMessage as Request, ServerResponse as Response } from 'http';
import parseRange, { Options } from 'range-parser';
export * from '@tinyhttp/url';
export declare const getRequestHeader: (req: Request) => (header: string) => string | string[];

@@ -8,2 +9,3 @@ export declare const getRangeFromHeader: (req: Request) => (size: number, options?: Options) => -1 | -2 | parseRange.Ranges;

export declare const getAccepts: (req: Request) => (...types: string[]) => string | false | string[];
export * from '@tinyhttp/url';
export declare const getAcceptsEncodings: (req: Request) => (...encodings: string[]) => string | false | string[];
export declare const getAcceptsCharsets: (req: Request) => (...charsets: string[]) => string | false | string[];

@@ -45,3 +45,11 @@ import parseRange from 'range-parser';

};
const getAcceptsEncodings = (req) => (...encodings) => {
const accepts = new Accepts(req);
return accepts.encodings(encodings);
};
const getAcceptsCharsets = (req) => (...charsets) => {
const accepts = new Accepts(req);
return accepts.charsets(charsets);
};
export { checkIfXMLHttpRequest, getAccepts, getFreshOrStale, getRangeFromHeader, getRequestHeader };
export { checkIfXMLHttpRequest, getAccepts, getAcceptsCharsets, getAcceptsEncodings, getFreshOrStale, getRangeFromHeader, getRequestHeader };
{
"name": "@tinyhttp/req",
"version": "0.1.7",
"version": "0.1.8",
"type": "module",

@@ -5,0 +5,0 @@ "description": "request extensions for tinyhttp",

@@ -6,2 +6,4 @@ import { IncomingMessage as Request, ServerResponse as Response } from 'http'

export * from '@tinyhttp/url'
export const getRequestHeader = (req: Request) => (header: string): string | string[] => {

@@ -57,2 +59,12 @@ const lc = header.toLowerCase()

export * from '@tinyhttp/url'
export const getAcceptsEncodings = (req: Request) => (...encodings: string[]) => {
const accepts = new Accepts(req)
return accepts.encodings(encodings)
}
export const getAcceptsCharsets = (req: Request) => (...charsets: string[]) => {
const accepts = new Accepts(req)
return accepts.charsets(charsets)
}

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