feat: in stress testing use device ID sent in headers
This commit is contained in:
parent
6fb2b29bcb
commit
0a120203be
1 changed files with 4 additions and 3 deletions
|
|
@ -14,12 +14,13 @@ function sha256 (buf) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const populateDeviceId = function (req, res, next) {
|
const populateDeviceId = function (req, res, next) {
|
||||||
const deviceId = _.isFunction(req.connection.getPeerCertificate)
|
let deviceId = _.isFunction(req.connection.getPeerCertificate)
|
||||||
? sha256(req.connection.getPeerCertificate()?.raw)
|
? sha256(req.connection.getPeerCertificate()?.raw)
|
||||||
: IS_STRESS_TESTING
|
|
||||||
? 'placeholder' /* TODO: req... ? */
|
|
||||||
: null
|
: null
|
||||||
|
|
||||||
|
if (!deviceId && IS_STRESS_TESTING)
|
||||||
|
deviceId = req.headers.device_id
|
||||||
|
|
||||||
if (!deviceId) return res.status(500).json({ error: 'Unable to find certificate' })
|
if (!deviceId) return res.status(500).json({ error: 'Unable to find certificate' })
|
||||||
req.deviceId = deviceId
|
req.deviceId = deviceId
|
||||||
req.deviceTime = req.get('date')
|
req.deviceTime = req.get('date')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue