MCPcopy Create free account
hub / github.com/socketstream/socketstream / Session

Function Session

lib/session/session.js:23–35  ·  view source on GitHub ↗

* Create a new `Session` with the given request and `data`. * * @param {IncomingRequest} req * @param {Object} data * @api private

(req, data)

Source from the content-addressed store, hash-verified

21 */
22
23function Session(req, data) {
24 Object.defineProperty(this, 'req', { value: req });
25 Object.defineProperty(this, 'id', { value: req.sessionID });
26
27 if (typeof data === 'object' && data !== null) {
28 // merge data into this, ignoring prototype properties
29 for (var prop in data) {
30 if (!(prop in this)) {
31 this[prop] = data[prop]
32 }
33 }
34 }
35}
36
37/**
38 * Update reset `.cookie.maxAge` to prevent

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected