Files
cypress/packages/server/lib/controllers/client.js
Zach Bloomquist fe785749e8 server decaf cleanup
cleanup
2020-06-04 14:48:33 -04:00

25 lines
630 B
JavaScript

const debug = require('debug')('cypress:server:controllers:client')
const socketIo = require('@packages/socket')
// hold onto the client source + version in memory
const clientSource = socketIo.getClientSource()
const clientVersion = socketIo.getClientVersion()
module.exports = {
handle (req, res) {
const etag = req.get('if-none-match')
debug('serving socket.io client %o', { etag, clientVersion })
if (etag && (etag === clientVersion)) {
return res.sendStatus(304)
}
return res
.type('application/javascript')
.set('ETag', clientVersion)
.status(200)
.send(clientSource)
},
}