(url)
| 177 | |
| 178 | // Parses a URL into hostname and pathname |
| 179 | _parseUrl (url) { |
| 180 | // URL specified as string |
| 181 | if (typeof url === 'string') { |
| 182 | return URL.parse(url) |
| 183 | } |
| 184 | // URL specified as Express request object |
| 185 | if (!url.pathname && url.path) { |
| 186 | const { hostname, path } = url |
| 187 | return { hostname, pathname: path.replace(/[?#].*/, '') } |
| 188 | } |
| 189 | // URL specified as object |
| 190 | return url |
| 191 | } |
| 192 | |
| 193 | // Gets the expected content type based on resource type and the extension of the path |
| 194 | _getContentTypeFromExtension (path) { |
no outgoing calls
no test coverage detected