mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-25 08:29:06 -06:00
* dependency: bump mime dep * changelog entry * yarn lock update * add pending to changelog * index on mime-dep-update:ccff6a976eadd pending to changelog * index on mime-dep-update:ccff6a976eadd pending to changelog * another removal of package * changelog update * index on mime-dep-update:ccff6a976eadd pending to changelog * whoops wrong issue * fix test that was just....wrong * Revert "fix test that was just....wrong" This reverts commit73ed5b0867. * nvm, application/javascript is obsolete * app/js to text/js updates * downgrade to mime 3.0.0 * back to application/javascript * index on mime-dep-update:23cbb7783bMerge branch 'mime-dep-update' of https://github.com/cypress-io/cypress into mime-dep-update * index on mime-dep-update:23cbb7783bMerge branch 'mime-dep-update' of https://github.com/cypress-io/cypress into mime-dep-update * index on mime-dep-update:23cbb7783bMerge branch 'mime-dep-update' of https://github.com/cypress-io/cypress into mime-dep-update --------- Co-authored-by: cypress-bot[bot] <+cypress-bot[bot]@users.noreply.github.com> Co-authored-by: AtofStryker <bglesias@gmail.com>
26 lines
720 B
JavaScript
26 lines
720 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('text/javascript')
|
|
.set('ETag', clientVersion)
|
|
.status(200)
|
|
// TODO: replace this entire file and sendFile call with `express.static`.
|
|
.sendFile(clientSourcePath)
|
|
},
|
|
}
|