mirror of
https://github.com/cypress-io/cypress.git
synced 2026-04-28 19:00:03 -05:00
b0378dc04e
* renames * Refactor proxy into own package, implement middleware pattern don't need these mocha opts anymore fix test no more zunder READMEs fix test * pass request by reference * fix cors path * Move replace_stream to proxy, concat-stream util in network * Pin dependency versions * Revert addDefaultPort behavior * Add READMEs for proxy, network * Update README.md * eslint --fix * set to null not undefined * use delete and bump node types * import cors from package now * parse-domain@2.3.4 * proxy package needs common-tags * move pumpify dep * load through where it's needed, remove unused passthru_stream * remove unneeded getbuffer call Co-authored-by: Gleb Bahmutov <gleb.bahmutov@gmail.com>
19 lines
493 B
TypeScript
19 lines
493 B
TypeScript
import _ from 'lodash'
|
|
import minimatch from 'minimatch'
|
|
import { stripProtocolAndDefaultPorts } from './uri'
|
|
|
|
export function matches (urlToCheck, blacklistHosts) {
|
|
// normalize into flat array
|
|
blacklistHosts = [].concat(blacklistHosts)
|
|
|
|
urlToCheck = stripProtocolAndDefaultPorts(urlToCheck)
|
|
|
|
// use minimatch against the url
|
|
// to see if any match
|
|
const matchUrl = (hostMatcher) => {
|
|
return minimatch(urlToCheck, hostMatcher)
|
|
}
|
|
|
|
return _.find(blacklistHosts, matchUrl)
|
|
}
|