* See if a given request should be handled by this server instance. * * @param {http.IncomingMessage} req Request object to inspect * @return {Boolean} `true` if the request is valid, else `false` * @public
(req)
| 222 | * @public |
| 223 | */ |
| 224 | shouldHandle(req) { |
| 225 | if (this.options.path) { |
| 226 | const index = req.url.indexOf('?'); |
| 227 | const pathname = index !== -1 ? req.url.slice(0, index) : req.url; |
| 228 | |
| 229 | if (pathname !== this.options.path) return false; |
| 230 | } |
| 231 | |
| 232 | return true; |
| 233 | } |
| 234 | |
| 235 | /** |
| 236 | * Handle a HTTP Upgrade request. |
no outgoing calls
no test coverage detected