MCPcopy
hub / github.com/mswjs/msw / predicate

Method predicate

src/core/handlers/HttpHandler.ts:165–173  ·  view source on GitHub ↗
(args: {
    request: Request
    parsedResult: HttpRequestParsedResult
    resolutionContext?: ResponseResolutionContext
  })

Source from the content-addressed store, hash-verified

163 }
164
165 async predicate(args: {
166 request: Request
167 parsedResult: HttpRequestParsedResult
168 resolutionContext?: ResponseResolutionContext
169 }) {
170 const hasMatchingMethod = this.matchMethod(args.request.method)
171 const hasMatchingUrl = args.parsedResult.match.matches
172 return hasMatchingMethod && hasMatchingUrl
173 }
174
175 private matchMethod(actualMethod: string): boolean {
176 return this.info.method instanceof RegExp

Callers 4

testFunction · 0.45
runFunction · 0.45

Calls 1

matchMethodMethod · 0.95

Tested by 1

testFunction · 0.36