New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

server-timing

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

server-timing - npm Package Compare versions

Comparing version 3.3.1 to 3.3.2

2

index.js

@@ -49,3 +49,3 @@ 'use strict'

res.setHeader('Server-Timing', [].concat(existingHeaders || []).concat(headers).join(', '))
res.setHeader('Server-Timing', [].concat(existingHeaders || []).concat(headers))
}

@@ -52,0 +52,0 @@ })

{
"name": "server-timing",
"version": "3.3.1",
"version": "3.3.2",
"description": "This module can add `ServerTiming` Header to http response, and be able to use express middleware",

@@ -31,3 +31,3 @@ "main": "index.js",

"@types/express": "^4.17.3",
"@types/node": "^12.12.30",
"@types/node": "^16.0.0",
"minimist": "^1.2.5",

@@ -38,11 +38,11 @@ "on-headers": "^1.0.2"

"assert-stream": "1.1.1",
"coveralls": "3.1.0",
"coveralls": "3.1.1",
"eater": "4.0.4",
"espower-loader": "1.2.2",
"express": "4.17.1",
"express": "4.18.1",
"must-call": "1.0.0",
"nyc": "15.1.0",
"power-assert": "1.6.1",
"standard": "16.0.1"
"standard": "17.0.0"
}
}

@@ -47,2 +47,33 @@ 'use strict'

test('success: http append more than one server timing header', () => {
const server = http.createServer((req, res) => {
serverTiming()(req, res)
res.setMetric('foo', 100.0)
res.setMetric('bar', 10.0, 'Bar is not Foo')
res.setMetric('baz', 0)
res.end('hello')
}).listen(0, () => {
http.get(`http://localhost:${server.address().port}/`, mustCall((res) => {
const assertStream = new AssertStream()
assertStream.expect('hello')
res.pipe(assertStream)
const serverTimingHeaders = []
res.rawHeaders.forEach(
(key, index) => {
key === 'Server-Timing' && serverTimingHeaders.push(res.rawHeaders[index + 1])
}
)
assert(serverTimingHeaders.length === 4)
serverTimingHeaders.forEach(
value => assert(
/^\w+;\sdur=\d+(\.\d+)?(;\sdesc="[\w\s]+")?$/.test(value)
)
)
server.close()
}))
})
})
test('success: http request twice more server timing response', () => {

@@ -49,0 +80,0 @@ let count = 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