@tinyhttp/res
Advanced tools
Comparing version 0.4.5 to 0.4.6
# @tinyhttp/res | ||
## 0.4.6 | ||
### Patch Changes | ||
- Forgot to bump | ||
## 0.4.5 | ||
@@ -4,0 +10,0 @@ |
@@ -8,1 +8,2 @@ export * from '@tinyhttp/send'; | ||
export * from './download'; | ||
export * from './append'; |
@@ -215,2 +215,13 @@ import { sendFile } from '@tinyhttp/send'; | ||
export { attachment, clearCookie, download, formatResponse, getResponseHeader, redirect, setContentType, setCookie, setHeader, setLinksHeader, setLocationHeader, setVaryHeader }; | ||
const append = (_req, res) => (field, value) => { | ||
const prevVal = res.getHeader(field); | ||
let newVal = value; | ||
// additional type checks for typescript to not throw errors | ||
if (prevVal && typeof newVal !== 'number' && typeof prevVal !== 'number') { | ||
newVal = Array.isArray(prevVal) ? prevVal.concat(newVal) : Array.isArray(newVal) ? [prevVal].concat(newVal) : [prevVal, newVal]; | ||
} | ||
res.setHeader(field, newVal); | ||
return res; | ||
}; | ||
export { append, attachment, clearCookie, download, formatResponse, getResponseHeader, redirect, setContentType, setCookie, setHeader, setLinksHeader, setLocationHeader, setVaryHeader }; |
{ | ||
"name": "@tinyhttp/res", | ||
"version": "0.4.5", | ||
"version": "0.4.6", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "response extensions for tinyhttp", |
@@ -8,1 +8,2 @@ export * from '@tinyhttp/send' | ||
export * from './download' | ||
export * from './append' |
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
35899
23
798