* Handles connection setup for incoming requests * @param {Object} req - Request object * @param {Object} res - Response object * @returns {void}
(req, res)
| 98 | * @returns {void} |
| 99 | */ |
| 100 | connect (req, res) { |
| 101 | req.csrf = this.canModify(req.method) === false && this.canModify(req.allow) && this.security.csrf === true; |
| 102 | req.hypermedia = this.hypermedia.enabled; |
| 103 | req.hypermediaHeader = this.hypermedia.header; |
| 104 | req.private = false; |
| 105 | req.protect = false; |
| 106 | req.protectAsync = false; |
| 107 | req.unprotect = false; |
| 108 | req.url = req.parsed.pathname; |
| 109 | req.server = this; |
| 110 | |
| 111 | if (req.cors) { |
| 112 | const header = `${ACCESS_CONTROL}${HYPHEN}${req.method === OPTIONS ? ALLOW : EXPOSE}${HYPHEN}${HEADERS}`; |
| 113 | |
| 114 | res.removeHeader(header); |
| 115 | res.header(header, `${EXPOSE_HEADERS}${req.csrf ? `, ${this.security.key}` : EMPTY}${this.corsExpose.length > INT_0 ? `, ${this.corsExpose}` : EMPTY}`); |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | /** |
| 120 | * Creates an EventSource instance |
nothing calls this directly
no test coverage detected