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

@tinyhttp/res

Package Overview
Dependencies
Maintainers
1
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tinyhttp/res - npm Package Compare versions

Comparing version 0.5.8 to 0.5.9

8

CHANGELOG.md
# @tinyhttp/res
## 0.5.9
### Patch Changes
- strip bytes and support non string res.send
- Updated dependencies [undefined]
- @tinyhttp/send@0.5.3
## 0.5.8

@@ -4,0 +12,0 @@

4

package.json
{
"name": "@tinyhttp/res",
"version": "0.5.8",
"version": "0.5.9",
"type": "module",

@@ -44,3 +44,3 @@ "description": "response extensions for tinyhttp",

"@tinyhttp/req": "0.5.3",
"@tinyhttp/send": "0.5.2",
"@tinyhttp/send": "0.5.3",
"es-mime-types": "^0.0.16",

@@ -47,0 +47,0 @@ "es-vary": "^0.0.7",

@@ -22,11 +22,7 @@ import { IncomingMessage as I, ServerResponse as S } from 'http'

if (signed && !secret) {
throw new Error('cookieParser("secret") required for signed cookies')
}
if (signed && !secret) throw new Error('cookieParser("secret") required for signed cookies')
let val = typeof value === 'object' ? 'j:' + JSON.stringify(value) : String(value)
if (signed) {
val = 's:' + sign(val, secret)
}
if (signed) val = 's:' + sign(val, secret)

@@ -38,5 +34,3 @@ if (options.maxAge) {

if (options.path == null) {
options.path = '/'
}
if (options.path == null) options.path = '/'

@@ -49,5 +43,3 @@ res.setHeader('Set-Cookie', cookie.serialize(name, String(val), options))

export const clearCookie = <Request extends I = I, Response extends S = S>(req: Request, res: Response) => (name: string, options?: cookie.SerializeOptions): Response => {
const opts = Object.assign({}, { expires: new Date(1), path: '/' }, options)
return setCookie(req, res)(name, '', opts)
return setCookie(req, res)(name, '', Object.assign({}, { expires: new Date(1), path: '/' }, options))
}

@@ -43,5 +43,3 @@ import { contentDisposition } from '@tinyhttp/content-disposition'

for (const key of Object.keys(opts.headers)) {
if (key.toLowerCase() !== 'content-disposition') {
headers[key] = opts.headers[key]
}
if (key.toLowerCase() !== 'content-disposition') headers[key] = opts.headers[key]
}

@@ -48,0 +46,0 @@ }

@@ -39,5 +39,3 @@ import { IncomingMessage as I, ServerResponse as S } from 'http'

// "back" is an alias for the referrer
if (url === 'back') {
loc = (getRequestHeader(req)('Referrer') as string) || '/'
}
if (url === 'back') loc = (getRequestHeader(req)('Referrer') as string) || '/'

@@ -44,0 +42,0 @@ // set location

@@ -38,9 +38,6 @@ import { IncomingMessage as I, ServerResponse as S, STATUS_CODES } from 'http'

if (req.method === 'HEAD') {
res.end()
} else {
res.end(body)
}
if (req.method === 'HEAD') res.end()
else res.end(body)
return res
}

@@ -11,7 +11,4 @@ import * as mime from 'es-mime-types'

const pms = part.split(/ *= */)
if ('q' === pms[0]) {
ret.quality = parseFloat(pms[1])
} else {
ret.params[pms[0]] = pms[1]
}
if ('q' === pms[0]) ret.quality = parseFloat(pms[1])
else ret.params[pms[0]] = pms[1]
}

@@ -18,0 +15,0 @@

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