MCPcopy
hub / github.com/nock/nock / Interceptor

Interface Interceptor

types/index.d.ts:162–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160 }
161
162 interface Interceptor {
163 query(
164 matcher:
165 | boolean
166 | string
167 | DataMatcherMap
168 | URLSearchParams
169 | { (parsedObj: ParsedUrlQuery): boolean },
170 ): this
171
172 // tslint (as of 5.16) is under the impression that the callback types can be unified,
173 // however, doing so causes the params to lose their inherited types during use.
174 // the order of the overrides is important for determining the param types in the replay fns.
175 /* tslint:disable:unified-signatures */
176 reply(
177 replyFnWithCallback: (
178 request: Request,
179 callback: (
180 err: NodeJS.ErrnoException | null,
181 result: ReplyFnResult,
182 ) => void,
183 ) => void,
184 ): Scope
185 reply(
186 replyFn: (request: Request) => ReplyFnResult | Promise<ReplyFnResult>,
187 ): Scope
188 reply(
189 statusCode: StatusCode,
190 replyBodyFnWithCallback: (
191 request: Request,
192 callback: (
193 err: NodeJS.ErrnoException | null,
194 result: ReplyBody,
195 ) => void,
196 ) => void,
197 headers?: ReplyHeaders,
198 ): Scope
199 reply(
200 statusCode: StatusCode,
201 replyBodyFn: (request: Request) => ReplyBody | Promise<ReplyBody>,
202 headers?: ReplyHeaders,
203 ): Scope
204 reply(responseCode?: StatusCode, body?: Body, headers?: ReplyHeaders): Scope
205 /* tslint:enable:unified-signatures */
206
207 replyWithError(errorMessage: string | object): Scope
208 replyWithFile(
209 statusCode: StatusCode,
210 fileName: string,
211 headers?: ReplyHeaders,
212 ): Scope
213
214 matchHeader(name: string, value: RequestHeaderMatcher): this
215 basicAuth(options: { user: string; pass?: string }): this
216
217 times(newCounter: number): this
218 once(): this
219 twice(): this

Callers 47

tests.tsFile · 0.65
test_back.jsFile · 0.65
test_undici.jsFile · 0.65
test_events.jsFile · 0.65
test_query.jsFile · 0.65
tests.tsFile · 0.65
defineFunction · 0.65
test_fetch.jsFile · 0.65

Implementers 1

Interceptorlib/interceptor.js

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…