Skip to content

Commit

Permalink
Do not impose leadnig slash in the URL
Browse files Browse the repository at this point in the history
This artificial requirement was introduced by nock#1391.
  • Loading branch information
uxmaster committed Jan 16, 2021
1 parent 20e9f8a commit c208013
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions lib/interceptor.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,6 @@ module.exports = class Interceptor {
*/
constructor(scope, uri, method, requestBody, interceptorOptions) {
const uriIsStr = typeof uri === 'string'
// Check for leading slash. Uri can be either a string or a regexp, but
// When enabled filteringScope ignores the passed URL entirely so we skip validation.

if (
!scope.scopeOptions.filteringScope &&
uriIsStr &&
!uri.startsWith('/') &&
!uri.startsWith('*')
) {
throw Error(
`Non-wildcard URL path strings must begin with a slash (otherwise they won't match anything) (got: ${uri})`
)
}

if (!method) {
throw new Error(
Expand Down

0 comments on commit c208013

Please sign in to comment.