@tinyhttp/req
Advanced tools
Comparing version 0.1.7 to 0.1.8
# @tinyhttp/req | ||
## 0.1.8 | ||
### Patch Changes | ||
- Add `req.acceptsCharsets` and `req.acceptsEncodings` | ||
## 0.1.7 | ||
@@ -4,0 +10,0 @@ |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11248
186