mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-30 11:00:35 -06:00
* fix: use graceful-fs always, warn in development on sync calls * skip prop linting in some dirs * eslint rules * use AST-based lint rule instead * comment * ignore existsSync * run without nextTick * remove dev warning code * fix order * register TS first * fix tests * fix test * cover new call site * fix new test
26 lines
727 B
JavaScript
26 lines
727 B
JavaScript
const debug = require('debug')('cypress:server:controllers:client')
|
|
const socketIo = require('@packages/socket')
|
|
|
|
// hold onto the client source + version in memory
|
|
const clientSourcePath = socketIo.getPathToClientSource()
|
|
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)
|
|
// TODO: replace this entire file and sendFile call with `express.static`.
|
|
.sendFile(clientSourcePath)
|
|
},
|
|
}
|